Cannot plot negative frequencies on Nichols with recent MATLAB versions
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
lepolonais03
el 15 de Dic. de 2023
Hello all, I'm having trouble plotting negative frequencies of nichols plot on my newest MATLAB version. I try specifying Nichols(sys,w) with w=[-100:0.1:-0.1 0.1:0.1:100] and it plots the expected figure with 2017a Matlab version but not with 2021b version and i cannot figure out why
0 comentarios
Respuesta aceptada
Paul
el 15 de Dic. de 2023
Editada: Paul
el 15 de Dic. de 2023
Hi lepolonais03.
Test case shows that only positive frequencies are considered, as you've obeserved.
sys = zpk(1,[2 3],4);
w=[-100:0.1:-0.1 0.1:0.1:100];
figure
nichols(sys,w)
That is odd, becasue the doc explicitly states that for this syntax:
"The vector w can contain both negative and positive frequencies."
As a workaround, you can use the output form of nichols and make the plot yourself
[mag,phase,wout] = nichols(sys,w);
figure
plot(squeeze(phase),squeeze(db(mag)))
Also, investigate nicholsplot, which might give an option to construct the plot to include negative frequencies.
figure
bode(sys,w)
2 comentarios
Paul
el 16 de Dic. de 2023
Editada: Paul
el 16 de Dic. de 2023
It's interesting that it worked the way you say in 2017b. The online doc only goes back as far as 2018b, and in 2018b the doc page nichols 2018b does NOT explicitly say that w can have negative values. Reviewing the release notes it seems like the intent of the negative frequencies option is only to support models with complex coefficients (if that's the case, the doc page should say that explicitly).
So another workaround, which is kind of janky, would be
sys = zpk(1,[2 3],4);
format long e
[z,p,k] = zpkdata(sys);
systemp = zpk(z{:},p{:},k + 1j*eps(k))
w=[-100:0.1:-0.1 0.1:0.1:100];
figure
nichols(systemp,w)
Más respuestas (0)
Ver también
Categorías
Más información sobre Plot Customization en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!