How can i multiply the transfer function with a vector)
조회 수: 43 (최근 30일)
이전 댓글 표시
How can i multiply the transfer function with a vector ??
댓글 수: 0
채택된 답변
Teja Muppirala
2011년 11월 21일
You can use the LSIM command.
For example:
s = tf('s');
G = (1.659e010*s^2 + 9.123e012*s + 4.147e014)/ (1.011e-005*s^7 + 0.02896*s^6 + 99.2*s^5 + 1.461e005*s^4+ 2.187e008*s^3 + 1.042e011*s^2 + 1.308e013*s+ 4.147e014)
t = 0:0.001:10;
u = sin(t.^3);
y = lsim(G,u,t);
plot(t,u,t,y);
legend({'Input (u)', 'Output (y)'})
추가 답변 (2개)
Teja Muppirala
2011년 11월 21일
You need to invert the transfer function. But simply taking 1/G leaves you with more zeros than poles, and so you cannot exactly solve the inverse problem. But you can get a good estimate if you multiply 1/G with a low pass filter to make it proper (number of poles = number of zeros). Then you can call LSIM once again. You will need a high sampling rate to do this accurately.
%%The forward problem
s = tf('s');
G = (1.659e010*s^2 + 9.123e012*s + 4.147e014)/ (1.011e-005*s^7 + 0.02896*s^6 + 99.2*s^5 + 1.461e005*s^4+ 2.187e008*s^3 + 1.042e011*s^2 + 1.308e013*s+ 4.147e014);
t = 0:0.00001:10;
u = sin(t.^3);
y = lsim(G,u,t);
plot(t,u,t,y);
legend({'Input (u)', 'Output (y)'})
%%The inverse problem:
% Step 1. Invert G
G_inverse = 1/G;
% Step 2. Make the low pass filter
lpf_order = numel(pole(G)) - numel(zero(G));
lpf_freq = 10*max(abs(real([pole(G); zero(G)]))); %Cutoff frequency 10x higher than highest zero/pole in G
[num,den] = butter(lpf_order,lpf_freq,'s');
% Step 3. Multiply the inverse by the low pass filter
G_inverse = G_inverse * tf(num,den)
% Step 4. Use LSIM with 'y' as the input
u_estimate = lsim(G_inverse,y,t);
figure;
plot(t,u,t,y,t,u_estimate);
legend({'Actual Input (u)', 'Output (y)', 'Estimated input (u estimate)'})
Alex
2011년 11월 20일
What form is your transfer function in?
This previous question might help. http://www.mathworks.com/matlabcentral/newsreader/view_thread/250601
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!