help-octave
[Top][All Lists]
Advanced

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

Re:


From: James Sherman Jr.
Subject: Re:
Date: Tue, 26 Mar 2013 21:06:22 -0400

On Tue, Mar 26, 2013 at 8:56 PM, twinclouds <address@hidden> wrote:
I have some question of plotting using octave.  These maybe very basic questions but I just cannot figure them out.  Can somebody help?  Thanks.
If I use the following code: (det1.m)
================================
lambda=8;
t = 1:0.2:12;
u = exp(-t.*t);
v = exp(-(t.*t+lambda*lambda)).*besseli(0,2*t*lambda);
plot(t,log10(u),t,log10(v))
================================
Everything works fine but the Y-plot range is too high.  Than, I added the following statement:
"axis([0 12 -5 0]);"
Then when I run det1 again, it always give me the error: "/home/fling/Simulation/detection/det1.m at line 3, column 1" no matter where I put the statement.  Even if I type it on the terminal screen, it also got:
===================================
octave:39> axis([0 12 -5 0]);
error: subscript indices must be either positive integers or logicals.
octave:39>
===================================
if I type "axis=[0 12 -5 0];"  I don't get error but the plot range didn't change.
I just cannot see anything that I did was wrong.  Please help!


_______________________________________________
Help-octave mailing list
address@hidden
https://mailman.cae.wisc.edu/listinfo/help-octave


I think the problem is that you're creating a variable "axis" which is conflicting with the function "axis".  Try typing "whos".  Does it show that axis is a 1 by 4 array?  If so, you should type "clear axis" to get rid of it.  It is bad practice (though really easy in octave, due to Matlab's silly namespace problems) to have variables with the same name as commonly used functions.  You can get into really painful debugging problems.

With your initial error, is that *all* the error said?  I'm guessing that it is more than just ending at column 3 line 1.  Or was there really nothing after that?

James Sherman


reply via email to

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