How to find f(x)*g(x)
6 views (last 30 days)
Show older comments
Hi!
If i have f(x) = 1 + x and g(x) = 1 - x, i want to find h(x) = f(x)*g(x) = (1+x)*(1-x)=1-x.^2 What should i do?
Thanks!
0 Comments
Answers (2)
Star Strider
on 25 Mar 2015
It looks like you already did it. To code it using anonymous functions:
f = @(x) 1 + x;
g = @(x) 1 - x;
h = @(x) f(x).*g(x);
x = linspace(-10, 10);
figure(1)
plot(x, f(x), x, g(x), x, h(x))
grid
legend('f(x)', 'g(x)', 'h(x)', 'Location', 'south')
11 Comments
See Also
Categories
Find more on Function Creation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!