piecewise continuous function in SImulink

조회 수: 9 (최근 30일)
Mikhail Fedkin
Mikhail Fedkin 2020년 11월 7일
댓글: Ameer Hamza 2020년 11월 7일
Hello!
I made a piecewise functions in Simulink:
function y = fcn(t)
y = piecewise(t < -1,-1, -1<t<1,0, t > 1,1);
pretty simple, but I got problem with output value of function.
"Simulink cannot determine sizes and/or types of the outputs for block "
How to deal with this problem?

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 11월 7일
piecewise is from symbolic toolbox. It will not work in Simulink. Use if-else block
function y = fcn(t)
if t < -1
y = -1;
elseif t < 1
y = 0;
else
y = 1;
end
  댓글 수: 2
Mikhail Fedkin
Mikhail Fedkin 2020년 11월 7일
this was my original function, but this one neither didn't work
function y = sign_with_deadzone (t,delay)
if(t > delay)
if(t > 0)
y = 1;
end
if(t < 0)
y = -1;
end
else
y = 0;
end
anyway thank you)
Ameer Hamza
Ameer Hamza 2020년 11월 7일
Is 't' the simulation time? If yes, then it will never be negative and t < 0 will never become true.

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by