piecewise continuous function in SImulink
9 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
采纳的回答
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 个评论
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 Center 和 File Exchange 中查找有关 Event Functions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!