[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Revised rlocus m-file
From: |
Daniel J Sebald |
Subject: |
Re: Revised rlocus m-file |
Date: |
Wed, 14 Mar 2007 23:11:01 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041020 |
John W. Eaton wrote:
On 13-Mar-2007, Daniel J Sebald wrote:
| However, I'm getting back a
| handle pointer which doesn't seem quite right. In rlocus.m I placed
| the following:
|
| hplt = plot (args{:});
| get(hplt)
|
| and I get
|
| ans = [...]
|
| But this is the handle to the *zeros* only. Should "plot", even
| with this argument format, return a handle to the whole plot? In
| other words, if one goes to the __plt2vv__.m
|
| retval = line (x, y, "keylabel", key, "color", color,
| "linestyle", options.linestyle,
| "marker", options.marker);
|
| which, I think, ends up being the retval, but that isn't the handle
| for the whole plot, is it?
If there are multiple lines created, the plot function should return a
vector of handles for all the lines. Try the following patch.
| Also, I notice in the rlocus.m plot that the zeros are actually
| filled dots, not open circles. It turns out now that the
| "pentagram" gets mapped to the open circle. Currently in plot
| options "o" in the filled circle. Shouldn't "o" be the open circle,
| not "pentagram"?
Yes.
Attached is a patch that rearranges symbols slightly.
o - open circle
. - filled circle (gnuplot's tiny little dot isn't a great plotting symbol)
"hexagram" - open square
and I've also touched up the rlocus.m file. Let me know what you think. (I'll
send a PNG to John and ASH separately.) Try it with
rlocus(zp([1+j, 1-j], [-1+2*j, -1-2*j,-5, -6, -7],1));
Dan
--- /usr/local/share/octave/2.9.9+/m/plot/__go_draw_axes__.m 2007-03-14
19:34:42.000000000 -0600
+++ ./__go_draw_axes__.m 2007-03-14 22:21:26.422697312 -0600
@@ -812,11 +812,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 +834,7 @@
case {"pentagram", "p"}
pt = "4";
case {"hexagram", "h"}
- pt = "6";
+ pt = "12";
case "none"
pt = "";
otherwise
--- /usr/local/share/octave/2.9.9+/m/control/base/rlocus.m 2007-03-14
19:34:28.000000000 -0600
+++ ./rlocus.m 2007-03-14 22:58:27.798996784 -0600
@@ -227,29 +227,63 @@
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
+ args{1,++kk} = [sigma_A sigma_A+len_A*cos(pi*(1+2*i_A/n_A))];
+ args{2,kk} = [0 len_A*sin(pi*(1+2*i_A/n_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
- Re: Revised rlocus m-file, John W. Eaton, 2007/03/07
- Re: Revised rlocus m-file, Daniel J Sebald, 2007/03/13
- Re: Revised rlocus m-file, John W. Eaton, 2007/03/14
- Re: Revised rlocus m-file, Daniel J Sebald, 2007/03/14
- Re: Revised rlocus m-file,
Daniel J Sebald <=
- Re: Revised rlocus m-file, Daniel J Sebald, 2007/03/15
- Re: Revised rlocus m-file, John W. Eaton, 2007/03/15
- Re: Revised rlocus m-file, Daniel J Sebald, 2007/03/15
- Re: Revised rlocus m-file, Daniel J Sebald, 2007/03/15
- Re: Revised rlocus m-file, John W. Eaton, 2007/03/15