help-octave
[Top][All Lists]
Advanced

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

Re: Function problem


From: Paul Kienzle
Subject: Re: Function problem
Date: Thu, 24 Nov 2005 21:41:55 -0500

You probably wnat:

        function y = t(x), y = x.**2; end

The '.' says square each element rather than returning
the matrix product x * x.

- Paul

On Nov 24, 2005, at 8:45 PM, blah BLABBER wrote:

If I define the following function:

 function t (x)
 x**2
 endfunction

 It seems that I cannot multiply this function by a  constant.

 For example:

 Octave:1> 2 * t(4)

 gives an error. The error says: "evaluating binary operator * "

Can anyone explain why this is ? This does not happen to me with other programs.

 Thanks much.



Yahoo! Music Unlimited - Access over 1 million songs. Try it free.




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