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!

 採用された回答

John D'Errico
John D'Errico 2020 年 12 月 5 日

0 投票

h = @(t) g(t).*f(t);
The .* operator was used to make it vectorized.

1 件のコメント

MrBanana
MrBanana 2020 年 12 月 5 日
Worked, thanks a lot!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeProgramming についてさらに検索

製品

リリース

R2020b

質問済み:

2020 年 12 月 5 日

コメント済み:

2020 年 12 月 5 日

Community Treasure Hunt

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

Start Hunting!

Translated by