margin() is returning PM = inf when this doesn't match the visual plot.
6 次查看(过去 30 天)
显示 更早的评论
EDIT: Running the same code through R2023a has solved the problem, but it did not work in R2022b.
I'm using Matlab to create a lead-lag controller with certain specifications (university course), and to find the compensator value, I wanted to use the margin() function to find and plot the gain and phase margins. However, Matlab calculates a phase margin of infinity, when I can see that the phase margin is approximately 18 in the plot itself. The plot also isn't showing the dotted lines anywhere on the phase subplot, which I haven't seen before.
Plot without the compensator, with a missing phase margin:

Similar plot with slightly different input transfer function:

Is there a reason that I'm not seeing the phase margin elements in the upper plot like I expected?
Input transfer function are below:
Cs = tf([alpha*Tz*K1,K1],[Tz,1]); % s-domain TF
Cz = c2d(Cs,T,'Tustin'); % z-domain TF using 'Tustin' method
Gs = tf(K,[Je,Be,0]);
Gz = c2d(Gs,T);
figure(8);
margin(Cz*Gz);
The constants used were generated in previous steps from Matlab:
alpha = 14.717, Tz = 6.901e-04, K1 = 1, K = 2.0329, Je = 7e-04, Be = 0.0061
2 个评论
Paul
2023-4-14
编辑:Paul
2023-4-14
Hi Emily,
Can you provide the inputs to the margin command that creates the upper plot? If the code is short enough, you can just copy/paste it into a new comment or as an edit to your question. Or, you can save the inputs to margin in a .mat file and use the paperclip icon in the INSERT portion of the ribbon to attach the .mat file to your question or a comment.
Paul
2023-4-14
If still intereseted in pursuing this, please add the value of T to the Question. Also, if we really want to be exact, just save Cz and Gz to .mat file and attach it to the queastion using the paperclip icon.
回答(1 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
