help-octave
[Top][All Lists]
Advanced

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

Re: Need Help Plotting exp(-0.5*x)*sin(x)


From: viveks
Subject: Re: Need Help Plotting exp(-0.5*x)*sin(x)
Date: Sun, 6 Aug 2000 11:08:23 +0530 (IST)


On Sat, 5 Aug 2000, Jonathan Drews wrote:

> x=(0.0:0.1:10.0)';
> data=[x,exp(-0.5*x)*sin(x)]
> 
> It returns the message:
> 
> error: operator *: nonconformant arguments (op1 is 101x1, op2 is 101x1)
> error: evaluating assignment expression near line 8, column 5 

Use ".*" instead of "*". The former is elementwise operation, and the
latter is defined as matrix multiplication. Try the code below:


        x=[0.0:0.1:10.0] ;
        y=exp(-0.5*x).*sin(x) ;
        plot (x, y)

It will be a good idea to spend an hour going through online docs of octave
using the command:

        help -i

There are enough examples there.

Vivek...



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

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



reply via email to

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