In MATLAB we use tf2ss, similarly how can we Implement this in simulink
4 ビュー (過去 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!