help-octave
[Top][All Lists]
Advanced

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

RE: Problem in plotting a specific function graph


From: Richardson, Anthony
Subject: RE: Problem in plotting a specific function graph
Date: Wed, 2 Jan 2019 15:15:24 +0000


> Subject: Problem in plotting a specific function graph
>
> I am new user of Octave. I wanted to plot a function and I wrote this code: 
> pi=3.14159;
> t=0:0.1:10;
> y=8*sinc(8*t)-4*sinc(2*t)*cos(6*pi*t);
> plot(t,y);
> print(hf,"f:\yef.png");
>
> but does not work.
> Can anybody advice? 
>
> Best Regards
> Stefanos Beligiannis

Change the "y=...." line to:

y=8*sinc(8*t)-4*sinc(2*t).*cos(6*pi*t);

Note the use of ".*" instead of "*" for the second multiplication.  "*" is for 
matrix multiplication while ".*" is used for element-by-element multiplication 
of the two operands.
The print statement should just be "print("f:\yef.png")" to print the current 
figure.

Tony Richardson


reply via email to

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