comparison scripts/control/base/bode.m @ 4422:92be67bc9301

[project @ 2003-06-04 17:43:15 by jwe]
author jwe
date Wed, 04 Jun 2003 17:43:15 +0000
parents de4471c26cd3
children b8105302cfe8
comparison
equal deleted inserted replaced
4421:747e1e895f7c 4422:92be67bc9301
146 if (nargout < 1), 146 if (nargout < 1),
147 ## Plot the information 147 ## Plot the information
148 save_automatic_replot = automatic_replot; 148 save_automatic_replot = automatic_replot;
149 unwind_protect 149 unwind_protect
150 automatic_replot = 0; 150 automatic_replot = 0;
151 if(gnuplot_has_multiplot) 151 oneplot();
152 oneplot();
153 endif
154 gset autoscale; 152 gset autoscale;
155 if(gnuplot_has_multiplot) 153 gset nokey;
156 gset nokey;
157 endif
158 clearplot(); 154 clearplot();
159 gset data style lines; 155 gset data style lines;
160 if(is_digital(sys)) 156 if(is_digital(sys))
161 xlstr = ["Digital frequency w=rad/sec. pi/T=",num2str(pi/systsam)]; 157 xlstr = ["Digital frequency w=rad/sec. pi/T=",num2str(pi/systsam)];
162 tistr = "(exp(jwT)) "; 158 tistr = "(exp(jwT)) ";
164 xlstr = "Frequency in rad/sec"; 160 xlstr = "Frequency in rad/sec";
165 tistr = "(jw)"; 161 tistr = "(jw)";
166 endif 162 endif
167 xlabel(xlstr); 163 xlabel(xlstr);
168 if(is_siso(sys)) 164 if(is_siso(sys))
169 if (gnuplot_has_multiplot) 165 subplot(2,1,1);
170 subplot(2,1,1);
171 endif
172 title(["|[Y/U]",tistr,"|, u=", nth(inname,1),", y=",nth(outname,1)]); 166 title(["|[Y/U]",tistr,"|, u=", nth(inname,1),", y=",nth(outname,1)]);
173 else 167 else
174 title([ "||Y(", tistr, ")/U(", tistr, ")||"]); 168 title([ "||Y(", tistr, ")/U(", tistr, ")||"]);
175 disp("MIMO plot from") 169 disp("MIMO plot from")
176 disp(__outlist__(inname," ")); 170 disp(__outlist__(inname," "));
194 semilogx(w,md); 188 semilogx(w,md);
195 else 189 else
196 loglog(w,md); 190 loglog(w,md);
197 endif 191 endif
198 if (is_siso(sys)) 192 if (is_siso(sys))
199 if (gnuplot_has_multiplot) 193 subplot(2,1,2);
200 subplot(2,1,2);
201 else
202 prompt("Press any key for phase plot");
203 endif
204 axvec = axis2dlim([vec(w),vec(phase)]); 194 axvec = axis2dlim([vec(w),vec(phase)]);
205 axvec(1:2) = wv; 195 axvec(1:2) = wv;
206 axis(axvec); 196 axis(axvec);
207 xlabel(xlstr); 197 xlabel(xlstr);
208 ylabel("Phase in deg"); 198 ylabel("Phase in deg");
209 title([ "phase([Y/U]", tistr, ... 199 title([ "phase([Y/U]", tistr, ...
210 "), u=", nth(inname,1),", y=",nth(outname,1)]); 200 "), u=", nth(inname,1),", y=",nth(outname,1)]);
211 grid("on"); 201 grid("on");
212 semilogx(w,phase); 202 semilogx(w,phase);
213 ## This should be the default for subsequent plot commands. 203 ## This should be the default for subsequent plot commands.
214 if(gnuplot_has_multiplot) 204 oneplot();
215 oneplot();
216 endif
217 endif 205 endif
218 unwind_protect_cleanup 206 unwind_protect_cleanup
219 automatic_replot = save_automatic_replot; 207 automatic_replot = save_automatic_replot;
220 end_unwind_protect 208 end_unwind_protect
221 else 209 else