How to plot pzmap, nyquist plot and bode plot in App Designer

5 Ansichten (letzte 30 Tage)
Kenneth Brampio
Kenneth Brampio am 8 Mai 2021
I have this GUI that accepts values for K,a,b,c,d and n to change the transfer function. My step response plot works fine but my pzmap, nyquist plot and bode plot wont work. The error message says : Error using plot
Data cannot have more than 2 dimensions.
Kvalue=app.EntervalueforKEditField.Value;
avalue=app.EntervalueforaEditField.Value;
bvalue=app.EntervalueforbEditField.Value;
cvalue=app.EntervalueforcEditField.Value;
dvalue=app.EntervaluefordEditField.Value;
nvalue=app.EntervaluefornEditField.Value;
sexplaststring = "";
i=5;
while i>0
if(nvalue>0)
sexpstring = " 0";
sexplaststring= sexpstring + sexpstring;
nvalue = nvalue -1;
end
i = i -1;
end
nvalue = app.EntervaluefornEditField.Value;
if(nvalue==0)
strdenom = "1 " + int2str(cvalue + dvalue) +" "+ int2str(cvalue*dvalue);
end
if(nvalue==1)
strdenom = "1 " + int2str(cvalue + dvalue) + " " + int2str(cvalue*dvalue) +" 0";
else
strdenom = "1 " + int2str(cvalue + dvalue) + " " + int2str(cvalue*dvalue) + sexplaststring;
end
gs=tf([Kvalue*avalue Kvalue*bvalue], [str2num(strdenom)]);
[Gm,Pm,Wcg,Wcp]=margin(gs);
app.Gmvalpz.Text = num2str(Gm);
app.Pmvalpz.Text = num2str(Pm);
app.Wcgvalpz.Text = num2str(Wcg);
app.Wcpvalpz.Text = num2str(Wcp);
[z,p,k]=tf2zp([Kvalue*avalue Kvalue*bvalue],[str2num(strdenom)]);
[y,t]=pzmap(p,z);
plot(app.UIAxes,t,y);

Antworten (1)

Shiva Kalyan Diwakaruni
Shiva Kalyan Diwakaruni am 13 Mai 2021
Hi,
You are receiving this error message because the data that you are plotting is an array, which has 3 dimensions. You can only plot data with two dimensions or less (e.g., a vector or a matrix).
Remove the extra singleton dimension in your data with the SQUEEZE function. For example The SQUEEZE function turns the 1x1x50 array into a 50x1 array that you can then plot.
refer to the below link
Hope it helps

Kategorien

Mehr zu Stability Analysis finden Sie in Help Center und File Exchange

Produkte


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by