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

9 visualizaciones (últimos 30 días)
Emily Reid
Emily Reid el 14 de Abr. de 2023
Comentada: Paul el 14 de Abr. de 2023
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 comentarios
Paul
Paul el 14 de Abr. de 2023
Editada: Paul el 14 de Abr. de 2023
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
Paul el 14 de Abr. de 2023
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.

Iniciar sesión para comentar.

Respuestas (1)

Emily Reid
Emily Reid el 14 de Abr. de 2023
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.

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by