In MATLAB we use tf2ss, similarly how can we Implement this in simulink
7 次查看(过去 30 天)
显示 更早的评论
I alredy made an euler algorithm for a system in Matlab and now I need to make the same in Simulink. In Matlab I took the help of tf2ss command to get the data of matrices A, B, C and D. Now inordeer to obtain the same result in Simulink How should I proceed.
% For Example
Fun = tf([1 2],[3 4 5]);
% Now Simply I use tf2ss to get A, B, C and D matrices
[A B C D] = tf2ss(Fun);
Please guide me, how to implement the same in simulink.
0 个评论
回答(1 个)
Raj
2019-6-27
Why not use the transfer function block directly instead of converting it to state space model? Anyways, you can use 'Matlab function block' & 'tf2ss' function to implement the same thing that you have done in Matlab. Something like this:
function [A,B,C,D] = Myfcn
A=zeros(2,2);
B=zeros(2,1);
C=B;
D=0;
coder.extrinsic('tf2ss') % Code generation not supported for tf2ss
[A B C D] = tf2ss([1 2],[3 4 5]);
end
2 个评论
Raj
2019-6-27
You have not shared your full code without which your 'while' is making no sense to me. What is 'condtn'? Its not defined anywhere. Why is another random variable 'j' getting incremented inside the loop which is not pre defined anywhere? What is delta_t? What is 'phi_T_SET'? Looks like you just want to do a matrix multiplication, (xdot=Ax+Bu & y=Cx+Du) then what is the necessity of this complicated while loop? It's quite simple to implement in Simulink. Just use the 'State Space' block and enter your A,B,C,D matrices.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spectral Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!