From: Walter Roberson on
Wei wrote:

> Thanks a lot for your attention.
> But I think if we want to use mesh or surf, we need to create our
> meshgrid, as
> iin regular 2D plot when we want to plot sth against sth, right?

Newer versions of Matlab detect that a vector was given for x and y and
treat it as if you had done a meshgrid() but without you having to
actually create the matrix.

> Anyway, I tried your way. I just got an empty plot...

Which Matlab version are you using?
From: Wei on
Version 7.0.1.24704 (R14) Service Pack 1.
I guess it's too old...
From: Walter Roberson on
Wei wrote:
> Version 7.0.1.24704 (R14) Service Pack 1.
> I guess it's too old...

Please quote enough of the previous thread to establish context.

Yes, I suspect R14 is too old to support giving vectors instead of
meshes for surf() and griddata.

You could work in sections, such as half of the x vs half of the y for
the grid, and either put the four sections together into a single matrix
for surf() or else do multiple surf() calls -- as long as you get the
correct x and y coordinates and use "hold on" then in theory the
surfaces should end up positioned next to each other. It _might_ help.
But how big are your arrays? And I don't think I caught whether the
memory error was in doing the meshgrid() or in doing the griddata ? You
think you have enough memory, but it would be good to have someone else
take a look at the figures. Use "who" to tell how big a variable is. If
you are on a PC, try memstats() to see the amount of free memory you
have available... it may well be significantly less than you thought.
From: Wei on
Walter Roberson <roberson(a)hushmail.com> wrote in message <bEIKn.37385$304.14325(a)newsfe12.iad>...
> Wei wrote:
> > Version 7.0.1.24704 (R14) Service Pack 1.
> > I guess it's too old...
>
> Please quote enough of the previous thread to establish context.
>
> Yes, I suspect R14 is too old to support giving vectors instead of
> meshes for surf() and griddata.
>
> You could work in sections, such as half of the x vs half of the y for
> the grid, and either put the four sections together into a single matrix
> for surf() or else do multiple surf() calls -- as long as you get the
> correct x and y coordinates and use "hold on" then in theory the
> surfaces should end up positioned next to each other. It _might_ help.
> But how big are your arrays? And I don't think I caught whether the
> memory error was in doing the meshgrid() or in doing the griddata ? You
> think you have enough memory, but it would be good to have someone else
> take a look at the figures. Use "who" to tell how big a variable is. If
> you are on a PC, try memstats() to see the amount of free memory you
> have available... it may well be significantly less than you thought.

The array is 3 by 128*128.
And the error was in doing the meshgrid.
Below is what I got for the memory:
Physical Memory (RAM):
In Use: 918 MB (39677000)
Free: 1111 MB (457c2000)
Total: 2030 MB (7ee39000)
Page File (Swap space):
In Use: 728 MB (2d8eb000)
Free: 3193 MB (c79b9000)
Total: 3922 MB (f52a4000)
Virtual Memory (Address Space):
In Use: 323 MB (14323000)
Free: 1724 MB (6bcbd000)
Total: 2047 MB (7ffe0000)
Largest Contiguous Free Blocks:
1. [at 25075000] 447 MB (1bf8b000)
2. [at 41044000] 413 MB (19d2c000)
3. [at 11810000] 311 MB (137f0000)
4. [at 69d76000] 125 MB (07d2a000)
5. [at 629c9000] 107 MB (06b37000)
6. [at 5d12a000] 88 MB (05896000)
7. [at 73026000] 29 MB (01d6a000)
8. [at 5b8b5000] 23 MB (017db000)
9. [at 71c03000] 19 MB (013fd000)
10. [at 7e4a1000] 18 MB (0124f000)
======= ==========
1585 MB (6312f000)

Thanks a lot.
From: Walter Roberson on
Wei wrote:

> Largest Contiguous Free Blocks:
> 1. [at 25075000] 447 MB (1bf8b000)

That is your maximum array size. I calculate that is about a 3 x 4420 x
4420 array, so I not immediately sure why your arrays do not fit. I
suggest you put in

whos
memstats

right before your meshgrid() call, to see how much memory you have
available at that point; also print out the size of "out" so you can
calculate how big an array is being requested.