Determine the output of the given Block diagram
조회 수: 9 (최근 30일)
이전 댓글 표시
Hi,
I have calculated by hand the output of the given block diagram Y(z), in Z-Domain. T=1 sec.
I get as result: Y(z)=4z/[3(z-1)^2]
I want to calculate the same result with matlab. Therefore I have written the following matlab script:
clear all
clc
s = tf('s');
% model Gp(s)
Gp = 2/s;
H = s;
% close-loop transfer function in continuous domain
Tc = feedback(Gp,H);
% model Y(s)
Y = Tc*(2/s);
%% continuous to discrete transformation
T = 1; % sampling time 1 sec
Y_z = c2d(Y,T,'zoh')
But with matlab I receive as result:
Y_z = (0.6667 z + 0.6667)/(z^2 - 2 z + 1)
So my question is, is my matlab code wrong? Can I define with the matlab command c2d also the location where the sampler is placed?
Thank you!
댓글 수: 0
채택된 답변
Paul
2021년 10월 9일
편집: Paul
2021년 10월 9일
Not clear how that Matlab code would mimic the by-hand solution without seeing the by-hand solution. But I really doubt that it does. Did your by-hand solution solve for the Y(s) by ignoring the sampler and then discretizing the result?
I solved the problem by hand and then evaluated it in Matlab and got the same result as your by-hand solution. If you post your by-hand solution we can probably figure out how to implement it in Matlab.
댓글 수: 3
Paul
2021년 10월 10일
Excellent (but replace the 5 with an s!).
Let's use the zpk forms instead of tf forms to make it easier to follow.
First define the transform variables:
s = zpk('s');
T = 1; % sample time is T = 1 as in the notes
z = zpk('z',T);
% define the continuous plant
Gs = 2/s
Now to discretize the combination of the plant and the ZOH, we do exactly as in your notes, and use the 'impulse' method of c2d on G(s)/s
Gz = (1 - inv(z))*c2d(Gs/s,T,'impulse')
Gz(z) has some pole-zero cancellations, so we can get rid of those
Gz = minreal(Gz)
Because G(s) is preceded by a ZOH, it's easier (and clearer?) to do
Gz = c2d(Gs,T,'zoh')
Now we have to operate on the product G(s)*H(s). Again, this product is preceded by the ZOH, so
Hs = s;
GHz = c2d(Gs*Hs,T,'zoh')
In this case we still have a pole-zero cancellation to deal with because nothing in the above operations "knew" to cancel the s in the numerator of Hs with the s in the denominator of Gs. So we can apply minreal to the output, but it's probaby cleaner to apply minreal to the input
GHz = c2d(minreal(Gs*Hs),T,'zoh')
Now compute the transfer function:
YoverR = Gz/(1+GHz)
Define the reference input
Rs = 2/s;
At this point, all that's left to do is compute Rz using c2d, keeping in mind that Rz is NOT preceded by a ZOH, and mulitply it by the transfer function to yield Yz.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!