mesh plot

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

mesh plot

asha g
I am trying to get a mesh plot in a program where I think the N and iter values are very high. 
 So it is taking too long. Is there some way I can change the following code in order to just get a sample of 1 in 5 or 1 in 10 points. That might reduce the density and may speed the whole thing. Please advise. Thanks Asha G 


 colormap(gray)
view(30,45)
[xx,zz]= meshgrid(x,z);
mesh(xx,zz,y)
qm = [xx(:) zz(:) y(:)];
save -mat-binary cabunbact1doctN41mesh xx zz y
save -ascii cabunbact1doctN41meshascii qm 
 
 
 

_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: mesh plot

Bård Skaflestad
On Fri, 2013-05-03 at 12:46 +0800, asha g wrote:
> I am trying to get a mesh plot in a program where I think the N and
> iter values are very high.

Your script doesn't refer to either 'N' or 'iter', so the following is a
*guess* that 'N' is numel(x) and 'iter' is numel(z).  Furthermore I
*assume* that the quantities 'x', 'y', and 'z' are computed by some
external means, have conformable dimensions and Just Exist[tm] in your
environment.

To pick up every five elements of 'y' in each coordinate direction, you
could do something like this:

        i = 1 : 5 : numel(x);
        j = 1 : 5 : numel(z);
        mesh(z(j), x(i), y(i,j))

Adjust the stride (in this case, '5') appropriately if you want more or
fewer points in your mesh plot.

Note: mesh(z(j), x(i), y(i,j)) is not a misprint.  If you use vectors as
coordinates, then number of rows of the third parameter must match the
number of elements of the *second* parameter and the number of columns
of the third parameter must match the number of elements of the first
parameter.


Sincerely,
--
Bård Skaflestad <[hidden email]>

_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: mesh plot

asha g

Your script doesn't refer to either 'N' or 'iter', so the following is a
*guess* that 'N' is numel(x) and 'iter' is numel(z).  Furthermore I
*assume* that the quantities 'x', 'y', and 'z' are computed by some
external means, have conformable dimensions and Just Exist[tm] in your
environment.

To pick up every five elements of 'y' in each coordinate direction, you
could do something like this:

        i = 1 : 5 : numel(x);
        j = 1 : 5 : numel(z);
        mesh(z(j), x(i), y(i,j))

Adjust the stride (in this case, '5') appropriately if you want more or
fewer points in your mesh plot.

Note: mesh(z(j), x(i), y(i,j)) is not a misprint.  If you use vectors as
coordinates, then number of rows of the third parameter must match the
number of elements of the *second* parameter and the number of columns
of the third parameter must match the number of elements of the first
parameter.

Am running it right now. Will keep you posted on whether I get the required result.
Asha 

_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: mesh plot

asha g
In reply to this post by Bård Skaflestad

 
        i = 1 : 5 : numel(x);
        j = 1 : 5 : numel(z);
        mesh(z(j), x(i), y(i,j))

Adjust the stride (in this case, '5') appropriately if you want more or
fewer points in your mesh plot.

Note: mesh(z(j), x(i), y(i,j)) is not a misprint.  If you use vectors as
coordinates, then number of rows of the third parameter must match the
number of elements of the *second* parameter and the number of columns
of the third parameter must match the number of elements of the first
parameter.

N = 41, iter = 111000;
vvvv(iter,:) = V;
tmax = 55; 
x= linspace(0,tmax,niter);
z = linspace(0,l,N);
y = vvvv';

On using the following 

i = 1 : 5 : numel(x);
        j = 1 : 5 : numel(z);
        mesh(z(j), x(i), y(i,j))


I get an error message at line mesh(z(j),x(i),y(i,j))

error: A(I): Index exceeds matrix dimension.

Maybe it needs to be rewritten 

Asha G 



_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: mesh plot

Bård Skaflestad
On Fri, 2013-05-03 at 17:46 +0800, asha g wrote:

> N = 41, iter = 111000;
> vvvv(iter,:) = V;

Okay.  This means that 'vvvv' has (at least) 'iter' (=111,000) rows.
You haven't said how many columns it has though.  I'm forced to assume
that it has N columns and that 'V' (whatever that is) is a 1-by-N (i.e.,
a 1-by-41) row vector.

>
> tmax = 55;
> x= linspace(0,tmax,niter);

I'm confused.  What is 'niter'?  Is it the maximum value of 'iter' or
something else entirely?  Whatever it is (presumably a positive
integer), at least we know that

        all(size(x) == [ 1, niter ])

> z = linspace(0,l,N);

        all(size(z) == [ 1, N ])

> y = vvvv';

Size unknown.  In the following, I'm going to assume that

        all(size(y) == [ N, niter ])

because that seems the most likely given your setup.  If that is not the
case, then you *really* need to tell us the size of 'y'.

> On using the following
>    i = 1 : 5 : numel(x);
>    j = 1 : 5 : numel(z);
>    mesh(z(j), x(i), y(i,j))
> I get an error message at line mesh(z(j),x(i),y(i,j))
> error: A(I): Index exceeds matrix dimension.

That's seems consistent with the fact that numel(x) (i.e., 'niter') is
(much) larger than numel(z) (i.e., 'N').

> Maybe it needs to be rewritten

By 'it' I assume you mean the 'mesh' call, rather than your own
calculations.  I already said in a previous e-mail that in an invocation
like

        mesh(U, V, W)

in which 'U' and 'V' are vectors, then the following conditions must
hold

        rows(W)    == numel(V)
        columns(W) == numel(U)

In other words, your 'mesh' invocation must then (assuming, as stated
above, that all(size(y) == [ N, niter ])) be written as

        mesh(z(j), x(i), y(j,i))


Sincerely,
--
Bård Skaflestad <[hidden email]>

_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: mesh plot

Bård Skaflestad
On Fri, 2013-05-03 at 13:39 +0200, Bård Skaflestad wrote:
>         mesh(z(j), x(i), y(j,i))

Sorry.  That should be

        mesh(x(i), z(j), y(j,i))


Sincerely,
--
Bård Skaflestad <[hidden email]>

_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: mesh plot

Zé
In reply to this post by asha g
On 05/03/2013 10:46 AM, asha g wrote:
>
> Maybe it needs to be rewritten
>
> Asha G

Off-topic: could you please refrain from sending HTML emails?

--

_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave