How can i multiply the transfer function with a vector)
Show older comments
How can i multiply the transfer function with a vector ??
Accepted Answer
More Answers (2)
Teja Muppirala
on 21 Nov 2011
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)'})
1 Comment
Mohamed Nassef
on 21 Nov 2011
Alex
on 20 Nov 2011
0 votes
What form is your transfer function in?
This previous question might help. http://www.mathworks.com/matlabcentral/newsreader/view_thread/250601
1 Comment
Mohamed Nassef
on 21 Nov 2011
Categories
Find more on MATLAB in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!