How can i use sign function under a function block in simulink ?
9 次查看(过去 30 天)
显示 更早的评论
Hey guys, i'm new in using simulink. And i have a problem by using "sign(signum)" fucntion, in a fucntion block. When i write my formula inside the function block and run it. I have syntax error. But i'm pretty sure i wrote the formula correct. And when i remove sign function from the formula, it works(but not correctly). So how can i use this "sign" fucntion inside a function block ? Please help me i'm stuck in a project right now. Thank you
回答(2 个)
Luuk Ladegaard
2018-9-24
Hey, I don't know whether you're still struggling with this problem, but I discovered that for some reason, you need to use "sgn()" instead of "sign()". I have no idea what's up with that, it's not an existing Matlab function, but it works in Simulink. I guess it's a mistake. :/
1 个评论
Zhe Chen
2020-4-3
I have the same problem. And your method works.
I dont know either why is that when I changed the sign function to sgn, the syntax error goes away.
A Jenkins
2014-4-23
Is that the full equation? Your parentheses don't match. (7 open and only 6 close)
Perhaps should be
(-Kc*u(1)-Bc*u(4)+Kc*u(2)/N-Fc*sign(u(5)+u(9)))/Jcin
2 个评论
A Jenkins
2014-4-23
Check that all of your parameters, Kc, Bc, etc are defined.
Also check that your input signal u, has a width of at least 9.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 General Applications 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!