Define a function that is a product of two previously defined functions

468 Views Asked by At

New to matlab and having difficulty with the syntax since im used to using mathematica.

In mathematica i can define two functions $f(x)=x$ and $g(x)=x^2$ and define a third function simply as $h(x)=f(x)g(x)$ where f(x) and g(x). How do i do the same process in matlab where f(x) and g(x) are just functions and not arrays or matrices?

Thanks in advance.

1

There are 1 best solutions below

0
On

You can try anonymous functions like this:

f = @(x) x;
g = @(x) x^2;

h = @(x) f(x) * g(x);