How to plot pzmap, nyquist plot and bode plot in App Designer
    10 ビュー (過去 30 日間)
  
       古いコメントを表示
    

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);
0 件のコメント
回答 (1 件)
  Shiva Kalyan Diwakaruni
    
 2021 年 5 月 13 日
        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
0 件のコメント
参考
カテゴリ
				Help Center および File Exchange で Stability Analysis についてさらに検索
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

