# Visualizing Eigenvalues

I am not so adept at mathematica. Despite, indirectly, finding a few examples, I cannot find a particular plot I am looking for.

The plot you see has a clear representation of complex eigenvalues. In MATLAB, it can be created with sgrid function but it is not so good looking. Any suggestions?

Premise:

Say you have a range of eigenvalue sets for varying parameter as seen in the plot. How do you make a nice plot this?

## 2 Answers

I will give you a starting point. I assume that your data consists of N points and looks like

{{angle 1, radius 1, eigenvalue 1}, ... , {angle N, radius N, eigenvalue N}}.

At first I create such a set of data randomly.

n = 20;
data = Transpose@{RandomReal[2 Pi, n], RandomReal[5, n],RandomReal[{0, 2},n]};


After that we create new sublists with the same eigenvalue using GatherBy :

data2 = GatherBy[data, Last];
eigenv = #[[1, -1]] & /@ data2;


And finally the Plot:

ListPolarPlot[#[[All, {1, 2}]] & /@ data2,
PolarGridLines -> Automatic, Frame -> True,
PlotMarkers -> {"\[Cross]", 30},
PlotStyle -> (ColorData["DarkRainbow"][Rescale[#, MinMax[eigenv]]] & /@ eigenv),
PlotLegends -> BarLegend[{"DarkRainbow", MinMax[eigenv]}]]


• whatever you plots looks like something I would want but I want to be able to manipulate it to exactly what I want. I do not have polar coordinates as you mention. For Gatherby I think you make individual sets only. What does eigenv does and whats with the first argument of ListPolarPlot? I am sorry, it may be trivial but I am still getting my head around #. In my case I would create set of eigenvalues for each value of parameter say $k$ which would be on the BarLegend. Again thank you for the patience!
– Zero
Commented Sep 26, 2016 at 19:46
• Can you please create such a set of data? Then I will answer your questions. Commented Sep 27, 2016 at 7:53

Looks like a RootLocusPlot to me.

https://reference.wolfram.com/language/ref/RootLocusPlot.html

• Nope sorry but root locus gives gain for the entire closed loop function. This is more on the side of being able to vary a parameters and see its affect!
– Zero
Commented Sep 26, 2016 at 7:54
• @Zero I think you'd just need to run several root locus plots and overlay the results. Commented Sep 26, 2016 at 7:59
• I have 3 parameters to be varied actually $k_1$, $k_2$ and $v_x$ (not shown here). While $k_1$ and $k_2$ are gains corresponing to two states, $v_x$ is a system parameter. The feedback is of the form $u_{fb}=k_1x_1+k_2x_2$. Now for using root locus to study the effect, you can imagine first I have to write the system in the proper form to use root locus (one gain only). This would be not so straightforward for the system parameter. I think it is not at all a viable.
– Zero
Commented Sep 26, 2016 at 8:15