Extract data from nyquist plot

9 Ansichten (letzte 30 Tage)
Andreas Bernatzky
Andreas Bernatzky am 15 Jun. 2020
Hello,
I am trying to extract the data of a nyquist plot and plot it into another figure (I have to do this for another API normally using nyquist would be ok for me).
If i try to plot the data again I get some strange behaviour compared to the original nyquist() plot. Anybody got an idea how to figure this out?
On the left is the nyquist plot created by matlab in
nyquist(G);
and on the right I replot the extracted data
plot(squeeze(re),squeeze(im));
Used lightweight example:
clear all;
close all;
G = tf([1],[1 0.5]);%observerd transfer funciton
G.OutputDelay = 8;
[MAG,PHASE,W] = bode(G);
figure %do "normal" nyquist plot and extract real and imaginary data
[re,im] = nyquist(G);%extract real and imaginary part
nyquist(G);
figure% do own nyquist plot with extracted data
plot(squeeze(re),squeeze(im));
Thanks for you help!

Akzeptierte Antwort

Ameer Hamza
Ameer Hamza am 15 Jun. 2020
Bearbeitet: Ameer Hamza am 15 Jun. 2020
This code shows how you can extract the data from the graphic handles
G = tf(1,[1 0.5]);%observerd transfer funciton
G.OutputDelay = 8;
fig = figure; %do "normal" nyquist plot and extract real and imaginary data
nyquist(G);
hg = findall(fig, 'Type', 'hggroup');
l = hg.Children;
xdata1 = l(1).XData;
ydata1 = l(1).YData;
xdata2 = l(2).XData;
ydata2 = l(2).YData;
figure% do own nyquist plot with extracted data
plot(xdata1, ydata1, xdata2, ydata2);
  3 Kommentare
Ameer Hamza
Ameer Hamza am 15 Jun. 2020
In your code, you can get a better resolution if you specify 'w' vector yourself
G = tf([1],[1 0.5]);%observerd transfer funciton
G.OutputDelay = 8;
[MAG,PHASE,W] = bode(G);
figure %do "normal" nyquist plot and extract real and imaginary data
w = 0:0.001:10;
[re,im] = nyquist(G, w);%extract real and imaginary part
nyquist(G);
figure% do own nyquist plot with extracted data
plot(squeeze(re),squeeze(im));
Andreas Bernatzky
Andreas Bernatzky am 15 Jun. 2020
I see. Thank you!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Dynamic System Models finden Sie in Help Center und File Exchange

Produkte


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by