"Malgorzata Wieteska" <
g.wie...@yahoo.ie> wrote in message
news:nijlvv$iov$1...@newscl01ah.mathworks.com...
> I get error message: Undefined operator '*' for input arguments of type
> 'function_handle'. while trying to use multiplication sign.
That's correct. You can't multiply a function handle. What you can do is
multiply _the result you get when you evaluate the function handle_.
f = @sin;
g = @cos;
h1 = f(5)*g(5) % WILL work
h2 = f*g; % WILL NOT work
If you need the result to be a function handle itself, use an anonymous
function.
h3 = @(x) f(x).*g(x)
h3(5) % WILL work
Note that inside h3 I evaluated f and g using h3's input. That is like
computing h1. Doing the following instead, which is like trying to compute
h2, would not work.
h4 = @(x) f.*g;
h4(5) % WILL NOT work
*snip*
--
Steve Lord
sl...@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com