How to find f(x)*g(x)

15 visualizaciones (últimos 30 días)
Tran
Tran el 25 de Mzo. de 2015
Comentada: John D'Errico el 6 de Abr. de 2021
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!

Respuestas (2)

Star Strider
Star Strider el 25 de Mzo. de 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 comentarios
Tran
Tran el 25 de Mzo. de 2015
Thank you so much James Tursa!
Star Strider
Star Strider el 25 de Mzo. de 2015
@James — Thank you!
@Tran — My pleasure!

Iniciar sesión para comentar.


Tanveer ul haq
Tanveer ul haq el 6 de Abr. de 2021
syms x
f = 1 + x;
g = 1 - x;
h = simplify(f*g)
  1 comentario
John D'Errico
John D'Errico el 6 de Abr. de 2021
Note that this does not actually solve the problem as asked.

Iniciar sesión para comentar.

Categorías

Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by