help-octave
[Top][All Lists]
Advanced

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

Re: Newbie: empty matix returned when expecting initialization.


From: Lorenzo Fiorentini
Subject: Re: Newbie: empty matix returned when expecting initialization.
Date: Wed, 05 Dec 2001 15:34:30 +0100

You have probably fallen into a trivial 2*N instead of (2*N) mistake.

Besides this, I suggest you to factorize such reticles and use the following 
form, which is probably better for your cpu as well:

zm1=(-N+1:2:-1)*kl/(2*N);                       % 
-(kl/2)+kl/(2*N):kl/N:-kl/(2*N);
zm2=(1:2:N-1)*kl/(2*N);                 % kl/(2*N):kl/N:((kl/2)-(kl/(2*N)));

I believe this will save tons of your precious debugging time!

(you can also save the v12n=1:2:N-1 vector just once, and then:
zm1 = (v12n-N)*kl/(2*N);
zm2 = v12n*kl/(2*N);
)

Lorenzo


05/12/01 8.40.27, Balakumar Swaminathan <address@hidden> ha scritto:

>Hi,
>
>
>When I have the following listing in a file and invoke it, the "zm2" 
>matrix remains an empty matrix; i cant figure out why. Any help is 
>appreciated.
>
>Thanks.
> 
>
>l=0.25;
>a=0.005;
>N=50;
>x1=-.906179845938664;
>x2=-.538469310105683;
>x3=0;
>x4=-x1;
>x5=-x2;
>w1=.236926885056189;
>w2=.478628670499366;
>w3=.568888888888889;
>w4=w1;
>w5=w2;
>ka=2*pi*a;
>kl=2*pi*l;
>klt=2*pi*l;
>zn=-kl/2:kl/N:kl/2;
>zm1=-(kl/2)+kl/(2*N):kl/N:-kl/(2*N);
>zm2=kl/(2*N):kl/N:((kl/2)-(kl/2*N));
>zm=[zm1,0,zm2];
>
>
>
>_________________________________________________________
>Do You Yahoo!?
>Get your free @yahoo.com address at http://mail.yahoo.com
>
>
>
>-------------------------------------------------------------
>Octave is freely available under the terms of the GNU GPL.
>
>Octave's home on the web:  http://www.octave.org
>How to fund new projects:  http://www.octave.org/funding.html
>Subscription information:  http://www.octave.org/archive.html
>-------------------------------------------------------------
>
>





-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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