## meshgrid

### priya (view profile)

on 8 Jun 2011

dimensions of X and Y are as given below

X = 1X89000 Y = 1X 89000

[uxmesh, uymesh] = meshgrid(X,Y);

would you please tell me what is wrong in the above statements? Whenever I execute the above statements, MATLAB keeps crashing..

## Products

No products are associated with this question.

### Matt Fig (view profile)

Answer by Matt Fig

### Matt Fig (view profile)

on 8 Jun 2011

Are you running out of memory? Why not tell us what prompted you to ask the question???

There is nothing syntactically wrong with the statement. However, you better have

8*2*89000^2 bytes (read: LOTS!!) of free memory, assuming X and Y are doubles...

priya

### priya (view profile)

on 8 Jun 2011

I need to find out the difference between true and calculated velocities and find out the error percentage of the velocities.

Matt Fig

### Matt Fig (view profile)

on 8 Jun 2011

In that case I would think it would be acceptable to use a FOR loop and loop over the calculated velocities one at a time to find where in the list of true velocities the closest number lies, like:

[err(ii), idx(ii)] = min(abs(cv(ii)-tv));

Walter Roberson

### Walter Roberson (view profile)

on 8 Jun 2011

Current versions of interp2() do not require meshgrid(). The documentation says (at least as of 2008b):

XI and YI can be matrices, in which case interp2 returns the values of Z corresponding to the points (XI(i,j),YI(i,j)). Alternatively, you can pass in the row and column vectors xi and yi, respectively. In this case, interp2 interprets these vectors as if you issued the command meshgrid(xi,yi).

### Walter Roberson (view profile)

Answer by Walter Roberson

### Walter Roberson (view profile)

on 8 Jun 2011

Are X and Y vectors? If so, then the above should work, but only if you have enough memory: 89000 x 89000 double precision numbers requires between 59 and 60 gigabytes.

#### Join the 15-year community celebration.

Play games and win prizes!

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi