Matlab Overall Transfer Function script based on Simulink Block Diagram.

38 views (last 30 days)
Hello, I am a real newbie to Matlab and still finding my feet with the basic operations. I am reallt struggling to get a Matlab script to produce an overall transfer function that will produce a step response that is identical to the block diagram in simulink that the script has been derived from. I have been over and over it, had my maths checked for the calutations regarding the negative feedback loops, but still no success. I am really hoping that someone on this cummunity may be able to come to my rescue and show me where I am going wrong. I have been at this for over a week now!!
I have attached some screen shots so you can see where I am coming from. The screen shot of the Matlab script shows to responses, the one with the black background is from Simulink, and the white background is Matlab. The Matlab response should be identical to the Simulink response. I have taken a screen shot of the block diagram and also my math working out to produce the transfer functions.
Thanks for taking the time to look at this problem.
  1 Comment
steven higham
steven higham on 22 Nov 2020
Thanks Paul,
I see the errors I have made and much appreciate your assistance with this problem.
Top Man!!!

Sign in to comment.

Accepted Answer

Paul
Paul on 22 Nov 2020
It would be much easier to see what you did if you posted your code instead of an image of your code.
Looking at your derivations, it looks like you didn't compute the transfer functions correctly. For example, FHG8 should be:
FHG8 = G6*G7 / (1 + G6*G7*G8) compare this denominator to yours.
Here is one approach to get the proper result:
G1 = tf(1,[.01 1]);
G2 = tf([0.17 1],[0.085 0]);
G3 = G1;
G4 = tf([0.15 1],[0.051 0]);
G5 = tf(70,[0.0067 1]);
G6 = tf(0.21,[0.15 1]);
G7 = tf(130,[1 0]);
G8 = tf(0.212);
G9 = tf(0.1,[0.01 1]);
G10 = tf(0.0044,[0.01 1]);
H1 = feedback(G6*G7,G8);
H2 = feedback(G4*G5*H1,G9*inv(G7));
H3 = feedback(G2*G3*H2,G10);
H4 = G1*H3;
step(H4,0:.01:10)
If you want to do transfer function algebra, which isn't recommended, to compare to your derivation:
F1 = minreal(G6*G7/(1 + G6*G7*G8));
F2 = minreal(G4*G5*F1/(1 + G4*G5*F1*G9*inv(G7)));
F3 = minreal(G2*G3*F2/(1 + G2*G3*F2*G10));
F4 = G1*F3;
step(F4,0:.01:10)

More Answers (0)

Categories

Find more on Simulink in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!