Add parameter (factor) to function

조회 수: 9 (최근 30일)
MrBanana
MrBanana 2020년 12월 5일
댓글: MrBanana 2020년 12월 5일
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일
h = @(t) g(t).*f(t);
The .* operator was used to make it vectorized.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by