Mon 15 Jun 2015 06:04:23 AM UTC, comment #12:
Thanks! This fixes it for me, too.
|
Mon 15 Jun 2015 05:29:22 AM UTC, comment #11:
on line 219
change to
rlpol(1:nroots,ii) = vec(crootssort (roots (den + gain*num)));
Im not sure what your sort_roots is called so I show it with my name
This fixes it for my system
|
Mon 15 Jun 2015 05:14:22 AM UTC, comment #10:
I made a silly mistake (two functions with the same name) and corrected it:
https://bitbucket.org/paramaniac/control/commits/d350b3e9b3426a9dbc56f4dd9532004da38f6d43
Furthermore, I found a system which still gives discontinuous plots:
The plot from the rlocus function released with control-2.8.1 used to look better in this case.
Any ideas? Thanks for any hints!
|
Sun 14 Jun 2015 03:02:03 PM UTC, comment #9:
Thank you very much for your help, guys! I've pushed a changeset:
https://bitbucket.org/paramaniac/control/commits/657fdd77f224cce75392c3d8ecf7ea15f92c4bae
|
Thu 11 Jun 2015 06:02:55 PM UTC, comment #8:
I looked at this some more and decided that the complex part should be sorted by the regular sort.
see attached file
(file #34205)
|
Wed 10 Jun 2015 02:29:46 PM UTC, comment #7:
I just looked at matlab online help and it says:
If A is complex, then sort(A) sorts the elements by magnitude. If more than one element has equal magnitude, the elements are sorted by phase angle on the interval [−π, π].
So I think we should treat this as a special case.
Lukas --> it is your final call.
|
Wed 10 Jun 2015 01:58:43 PM UTC, comment #6:
I am not sure what matlab does.(I don't have matlab)
and I am not sure what is the "correct way" of sorting complex numbers is. I just know that this is the sort that is needed for this operation in this function (rlocus.m).
|
Wed 10 Jun 2015 01:44:08 PM UTC, comment #5:
So this has to do with the way that Octave defines sorting for complex numbers, and not compatible with Matlab's sort. Octave sorts complex numbers by magnitude first, then by phase. Matlab sorts complex numbers by real part first.
|
Wed 10 Jun 2015 01:18:11 PM UTC, comment #4:
I have a solution to this problem that works for me.
I created a new function called
crootssort.m see attached file.
I then changed line 174 from
rlpol(1:nroots,ii) = vec(sort (roots (den + gain*num)));
to
rlpol(1:nroots,ii) = vec(crootssort (roots (den + gain*num)));
and now it works for me.
(file #34196)
|
Wed 10 Jun 2015 08:56:27 AM UTC, comment #3:
Thanks for reporting, but I'm afraid that I don't know how to fix this at the moment.
|
Tue 28 Apr 2015 10:02:52 PM UTC, comment #2:
this shows that the order of the roots changes as the gain increases:
for a = 23:1:26
a
roots([1 9 (a+18) (4*a)])
abs(roots([1 9 (a+18) (4*a)]))
endfor
|
Tue 28 Apr 2015 08:24:19 PM UTC, comment #1:
I can confirm this with rc3.
I did some digging anf found that what is happening is that the roots to plot are changing order as can be seen here:
Columns 124 through 126:
-4.91518 + 0.00000i -4.91220 + 0.00000i -2.04537 + 4.47197i
-2.04241 + 4.42627i -2.04390 + 4.44917i -4.90925 + 0.00000i
-2.04241 - 4.42627i -2.04390 - 4.44917i -2.04537 - 4.47197i
Columns 127 and 128:
-2.04682 + 4.49466i -2.04826 + 4.51726i
-4.90635 + 0.00000i -4.90349 + 0.00000i
-2.04682 - 4.49466i -2.04826 - 4.51726i
>>
In col. 125 and 126 we can see that the real branch has moved from first in the list to second, and thus the plot has the funny lines in it.
I ran this line to get this data:
[rldata_pd k_list_pd] = rlocus(G_pd*G, 0.21, 0, 26.);
|
Tue 28 Apr 2015 07:10:49 PM UTC, original submission:
When running the following program
The data contained in rldata_pd is scrambled such that starting at index 2628, row 1 and 2 are inverted, causing a discontinuous vector. The result of
show that behaviour and displays
This can also be replicated when a single argument is given to rlocus, but the location of the crossover point will be different.
|