margin() is returning PM = inf when this doesn't match the visual plot.

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
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.
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개)

Emily Reid
Emily Reid 2023년 4월 14일

0 개 추천

Running the unaltered code through R2023a seems to have fixed the plot, although I couldn't figure out any reason for the error in R2022b that I originally had.

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

제품

릴리스

R2022b

태그

질문:

2023년 4월 14일

댓글:

2023년 4월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by