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: A Scottedward Hodel
Subject: Re: Newbie: empty matix returned when expecting initialization.
Date: Wed, 05 Dec 2001 12:02:27 -0600
User-agent: Microsoft-Entourage/9.0.2509


On 12/5/01 1:40 AM, "Balakumar Swaminathan" <address@hidden> wrote:

> 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));

your final value is negative, your first is positive, and the step size is
positive => empty interval.

Debugging tips:
(1) Print out your values to make sure they make sense.
(2) I suggest adding parenthesis to avoid operator precedence problems:

    zm2=  (kl/(2*N)) : (kl/N) :(((kl/2)-(kl/2*N))) ;

"When in doubt, even if not, parenthesize" (Kernighan and Ritchie).

--
A. S. Hodel 200 Broun Hall Dept Elect & Comp Eng, Auburn Univ AL 36849-5201
http://www.eng.auburn.edu/~scotte   334 844 1854  Fax: -1809




-------------------------------------------------------------
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]