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!