필터 지우기
필터 지우기

simulation discrete-time model

조회 수: 24 (최근 30일)
massimiliano frasca
massimiliano frasca 2019년 11월 7일
댓글: Star Strider 2019년 11월 10일
I'm studying the linear model of a DC motor. In state-space form, the governing equations above can be expressed by choosing the rotational speed and electric current as the state variables.
So:
Ac = [-b/J k/J; -k/L -R/L];
Bc = [0; 1/L];
Cc = eye(2);
Dc = zeros(2,1);
I expressed all in discrete -time:
sys_TC = ss(Ac,Bc,Cc,Dc);
sys_TD = c2d(sys_TC,Ts);
[A,B,C,D] = ssdata(sys_TD);
Now I shuould simulate the model (TD). In this sense, I simulate the input signal with the function rand. How can I obtain the results of the output and collect them in a matrix?

채택된 답변

Star Strider
Star Strider 2019년 11월 7일
To simulate your system with the appropriate input, use the lsim function. You will need to create a time vector as well as the input signal vector. (You have a single-input system, so this is straightforward. For multiple-input systems, the number of columns in the input signal must match the number of columns of the B matrix.)
  댓글 수: 2
massimiliano frasca
massimiliano frasca 2019년 11월 10일
Thanks for your help, I tried to do how you suggest. How can you see from my question, the output should be a vector with two rows and one column, but when I use the lsim function I obtain a vector with one rows and one column. Did I make a mistake or is is this the output form of lsim function?
Star Strider
Star Strider 2019년 11월 10일
As always, my pleasure!
No, the output should be a matrix of N rows and two columns.
This code:
[u,t] = gensig('square',1,10,Ts);
y = lsim(sys_TD, u, t);
returns a (10001x2) output matrix in ‘y’ when I run it, as it should. If you are not using the gensig function, be sure to create ‘u’ and ‘t’ as column vectors.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Time and Frequency Domain Analysis에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by