help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mesh plot


From: Bård Skaflestad
Subject: Re: mesh plot
Date: Fri, 3 May 2013 13:39:41 +0200

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 <address@hidden>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]