How to generate this function in Simulink (Matlab code):
20.*t.*heaviside(t) - 40.*(t-10).*heaviside(t-10) + 20.*(t-(680)).*heaviside((t-(680)));

 채택된 답변

Walter Roberson
Walter Roberson 2021년 2월 8일

0 개 추천

If you are in a MATLAB Function Block then
heaviside = @(x) x >= 0;

댓글 수: 2

function y = fcn(t)
y = zeros(size(t));
heaviside = @(x) x >= 0;
y = 20.*t.*heaviside(t) - 40.*(t-10).*heaviside(t-10) + 20.*(t-(680)).*heaviside((t-(680)));
end
Marko Boskovic
Marko Boskovic 2021년 2월 8일
Thank you Walter!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 General Applications에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by