Heaviside function in simulink

조회 수: 5 (최근 30일)
Marko Boskovic
Marko Boskovic 2021년 2월 8일
댓글: Marko Boskovic 2021년 2월 8일
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일
If you are in a MATLAB Function Block then
heaviside = @(x) x >= 0;
  댓글 수: 2
Walter Roberson
Walter Roberson 2021년 2월 8일
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개)

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by