Mercurial > hg > octave-lyh
changeset 6413:cf8e671beada
[project @ 2007-03-15 14:11:51 by jwe]
author | jwe |
---|---|
date | Thu, 15 Mar 2007 14:11:51 +0000 |
parents | b2096bb759b1 |
children | 250eebbd7ccc |
files | scripts/ChangeLog scripts/control/base/rlocus.m scripts/plot/__go_draw_axes__.m |
diffstat | 3 files changed, 66 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,15 @@ +2007-03-15 John W. Eaton <jwe@octave.org> + + * plot/__go_draw_axes__: Make have_newer_gnuplot persistent. + From Daniel J Sebald <daniel.sebald@ieee.org>. + +2007-03-15 Daniel J Sebald <daniel.sebald@ieee.org> + + * plot/__go_draw_axes__.m (do_linestyle_command): Fix marker types. + + * control/base/rlocus.m: Add asymptotes to the plot. Use wider + lines and larger markers. + 2007-03-14 John W. Eaton <jwe@octave.org> * plot/__axis_label__.m: Accept additional property-value pairs
--- a/scripts/control/base/rlocus.m +++ b/scripts/control/base/rlocus.m @@ -227,29 +227,64 @@ if (! isempty (rlzer)) nelts++; endif + # add asymptotes + n_A = length (olpol) - length (olzer); + if (n_A > 0) + nelts += n_A; + endif args = cell (3, nelts); - for kk=1:rows(rlpol) - args{1,kk} = real (rlpol (kk,:)); - args{2,kk} = imag (rlpol (kk,:)); - args{3,kk} = "b-"; + kk = 0; + # asymptotes first + if (n_A > 0) + len_A = 2*max(abs(axlim)); + sigma_A = (sum(olpol) - sum(olzer))/n_A; + for i_A=0:n_A-1 + phi_A = pi*(2*i_A + 1)/n_A; + args{1,++kk} = [sigma_A sigma_A+len_A*cos(phi_A)]; + args{2,kk} = [0 len_A*sin(phi_A)]; + if (i_A == 1) + args{3,kk} = "k-;asymptotes;"; + else + args{3,kk} = "k-"; + endif + endfor + endif + # locus next + for ii=1:rows(rlpol) + args{1,++kk} = real (rlpol (ii,:)); + args{2,kk} = imag (rlpol (ii,:)); + if (ii == 1) + args{3,kk} = "b-;locus;"; + else + args{3,kk} = "b-"; + endif endfor - args{1,n_rlpol+1} = real(olpol); - args{2,n_rlpol+1} = imag(olpol); - args{3,n_rlpol+1} = "rx;open loop poles;"; - + # poles and zeros last + args{1,++kk} = real(olpol); + args{2,kk} = imag(olpol); + args{3,kk} = "rx;open loop poles;"; if (! isempty(rlzer)) - args{1,n_rlpol+2} = real(rlzer); - args{2,n_rlpol+2} = imag(rlzer); - args{3,n_rlpol+2} = "go;zeros;"; + args{1,++kk} = real(rlzer); + args{2,kk} = imag(rlzer); + args{3,kk} = "go;zeros;"; endif - plot (args{:}) + set (gcf,"visible","off"); + hplt = plot (args{:}); + set (hplt(kk--), "markersize", 2); + if (! isempty(rlzer)) + set(hplt(kk--), "markersize", 2); + endif + for ii=1:rows(rlpol) + set (hplt(kk--), "linewidth", 2); + endfor legend ("boxon", 2); grid ("on"); axis (axlim); xlabel (sprintf ("Root locus from %s to %s, gain=[%f,%f]: Real axis", inname{1}, outname{1}, gvec(1), gvec(ngain))); ylabel ("Imag. axis"); + set (gcf,"visible","on"); rldata = []; endif endfunction
--- a/scripts/plot/__go_draw_axes__.m +++ b/scripts/plot/__go_draw_axes__.m @@ -32,7 +32,8 @@ parent_figure_obj = get (axis_obj.parent); - have_newer_gnuplot = compare_versions (__gnuplot_version__ (), "4.0", ">"); + persistent have_newer_gnuplot ... + = compare_versions (__gnuplot_version__ (), "4.0", ">"); ## Set axis properties here? @@ -765,7 +766,8 @@ function style = do_linestyle_command (obj, idx, plot_stream) - have_newer_gnuplot = compare_versions (__gnuplot_version__ (), "4.0", ">"); + persistent have_newer_gnuplot ... + = compare_versions (__gnuplot_version__ (), "4.0", ">"); if (have_newer_gnuplot) fprintf (plot_stream, "set style line %d default;\n", idx); @@ -812,11 +814,11 @@ case "+" pt = "1"; case "o" - pt = "7"; + pt = "6"; case "*" pt = "3"; case "." - pt = "0"; + pt = "7"; case "x" pt = "2"; case {"square", "s"} @@ -834,7 +836,7 @@ case {"pentagram", "p"} pt = "4"; case {"hexagram", "h"} - pt = "6"; + pt = "12"; case "none" pt = ""; otherwise