matlab

Incrementing one value of a MATLAB array multiple times in one line

This is a question about incrementing one value of a MATLAB array multiple times in the same statement, without having to use a for loop. I set my array as: >> A = [10 20 30]; And then run: >> A([1, 1]) = A([1, 1]) + [20 3] A = 13 20 30 Clearly the 20 is ignored. However, i would like it to be included, so that: >> A ...

What does the following colon (:) mean in MATLAB syntax?

a = imread('autumn.tif'); a = double(a); [row col dim] = size(a); red = a(:, :, 1); green = a(:, :, 2); blue = a(:, :, 3); What does the colon : in the last three lines mean? (The above snippet is from "Image Processing" by Dhananjay Theckedath.) ...

Find values in a matrix and put them into a vector

It must be simple, but surprisingly I couldn't find an answer to this problem here or by trial-and-error. I want to get values out of a matrix (according to some condition) and place the values into a vector. I also need the subscript indices of the matching values. There is a lot of data so for loops are out. This is a correct (but...

Get list of property names and values for a MATLAB plot

In the MATLAB documentation for a particular type of plot (i.e. trisurf), it shows how to add properties, but does not give a list of what properties are applicable. Is there a way to find which properties and values are available for a particular plot type? ...

Alternative to Matlab

I'm looking for some environment that fulfil all conditions below: is free or have free student's licence enables to make dll that can be used in C# in Visual Studio 2010 has very good performance on matrix calculations has good documentation or examples/tutorials It does not have to be compatible with Matlab. ...

Subtract two trisurf plots from one another

I have two sets of data vectors X, Y, Z and X2, Y2, Z2 I currently plot them using trisurf on different graphs. Can I plot them on the same graph even if X Y and X2 Y2 are different. Can I subtract the surface plots? ...

Subscript indices must either be real positive integers or logicals with interp2

What does the error "Subscript indices must either be real positive integers or logicals" means when using interp2. X,Y,Z,XI,YI are all vectors of the same length. ...

use interp2 with vectors instead of mesh grids

I'm trying to use interp2 where my five inputs are all 1 by n vectors. Is this possible? or do I need to enter them in mesh format? ...

How do I set the values in x that are above the mean to their difference from the mean in MATLAB

How can I set the values in x that are above the mean to their difference from the mean. x = [3 15 9 12 -1 0 -12 9 6 1] ...

How can I change colormap of trisurf plot to better differentiate positive/negative values

I have a trisurf plot that goes above and below zero. How do I change the colormap such that I color code so that portions of the surface greater than zero are blue and portions below zero are red? ...

Failed to find library 'powerlib' matlab. Simulink program executing

When I tried to run a Simulink program under my R2009a Matlab, it showed an error message as follows: Failed to find library 'powerlib' referenced by 'dcmotor_openloop/Armature Current '. This library must be on your MATLAB path. I'm wondering where I can find this powerlib. ...

How do I re implement a color based histogram, do feature extraction based on color & measure features in an image in MATLAB?

For this picture: Draw histogram of R, G, B components of color (not using imhist) Change picture to binary so brown exoskeleton of insect is white Measure insect's exoskeleton's width and height EDIT: 1: I did that: a = imread('C:\a.jpg'); r = a(:,:,1); g = a(:,:,2); b = a(:,:,3); rhist = zeros(1,256); [w h] = size(a(:,:,1)); fo...

how to get some portion from an image in matlab?

i have an image I of size 512x256. i want to get some portion like a slice from this image I. like i want I1 of size 512x50 . ...

MATLAB: how to assign values on the diagonal?

Suppose I have an NxN matrix A, an index vector V consisting of a subset of the numbers 1:N, and a value K, and I want to do this: for i = V A(i,i) = K end Is there a way to do this in one statement w/ vectorization? e.g. A(something) = K The statement A(V,V) = K will not work, it assigns off-diagonal elements, and this is no...

I need this in my Biology class ... using MATLAB!

I'm trying to monitor the average temperature in a fabrication every hour to ensure quality control. How can I write a script that looks at the temperature inside the plant as a function of time, and outputs the times when the temperature drops below 10 degrees Celsius and when the temperature is above 80 degrees Celsius. My script sho...

How Can I generate two vectors (A and B) containing 100 randomly generated integer numbers from 0 to 10.

How Can I generate two vectors (A and B) containing 100 randomly generated integer numbers from 0 to 10. I want to Start the random number generation from state 0. That is use rand('state',0) before I start generating random numbers. Also I how can I compute the following: *The number of times the sum of A and B are greater than 10. ...

problems with TriScatteredInterp

I have two sets of scattered data x y z and x2 y2 z2 The following code should produce two overlapping surface plots F = TriScatteredInterp(x,y,z); z2i=F(x2,y2); tri = delaunay(x,y); plot = trisurf(tri,x2,y2,z2,'edgeColor','blue','FaceColor','blue','FaceAlpha',.5); hold on trisurf(tri,x2,y2,z2i,'edgeColor','red','FaceColor','red','Fa...

How do i get the upper (and lower) limits of an axis in MATLAB?

How do I find the minimum and maximum of the axis in a MATLAB plot? ...

turn scatter plot into area plot

I have a 2D scatter plot in MATLAB. Is it possible to interpolate the scatter plot to create an area plot? ...

What's the best way to declare symbolic constants in MATLAB?

Possible Duplicate: Constants in MATLAB As an interpreted language, MATLAB doesn't really have any support for compile-time constants such as macros in C or final fields in Java. So what is the best way to declare constants, especially when they are to be heavily accessed? Couple of ideas I've tried but none has been found sa...