Add parameter (factor) to function

Hey everyone,
I have the following two calculations:
f = @(t) pi * sin(pi*t/4) - pi/2;
g = @(t) cos(t);
I simply want to multiply g with f:
@(t) pi * sin(pi*t/4) - pi/2 * cos(t)
Is there any possibility to do this?
I am using MATLAB R2020b.
Thanks in advance!

 Respuesta aceptada

John D'Errico
John D'Errico el 5 de Dic. de 2020
h = @(t) g(t).*f(t);
The .* operator was used to make it vectorized.

Más respuestas (0)

Categorías

Más información sobre Programming en Centro de ayuda y File Exchange.

Productos

Versión

R2020b

Preguntada:

el 5 de Dic. de 2020

Comentada:

el 5 de Dic. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by