0
$\begingroup$

I need to plot several eigenvalues from different matrices, so I would like to know how can I change the name of the curve with each set of matrices-eigenvalue. What I am doing is the following:

For[i = 1, i < 9, i++,
  For[j = 1, j < 9, j++,  
    t[i, j] = {{t11[i, j], t12[i, j], t13[i, j]}, 
               {t21[i, j], t22[i, j], t23[i, j]}, 
               {t31[i, j], t32[i, j], t33[i, j]}} ;
    eint[i, j] = Eigenvalues[t[i, j]]  
  ]
]

In the loop I create a big amount of matrices $t$ (each t[i,j] is a matrix), and its eigenvalues are in eint, Then I make the plots of all eigenvalues such that

Show[
  Table[
    Plot[
      {Abs[eint[i, j][[1]]], Abs[eint[i, j][[2]]], Abs[eint[i, j][[3]]]}, 
      {p, 0.01, 1}, PlotRange -> {{0, 1}, {0.4, 1} }
    ],
    {i, 1, 8}, {j, 1, 8}
  ]
]

where eint[i, j][[1]] is the first eigenvalue of the matrix t[i,j].

The problem is that I need to write the corresponding matrix in the legend. I tried creating two lists with the names of the matrices

namat02 = {"mc011", "mc012", "mc013", "mc014", "mc015", "mc016", "mc017", "mc018"}
namat03 = {"mc031", "mc032", "mc033", "mc034", "mc035", "mc036", "mc037", "mc038"}

and then

PlotLegends->{
 {namat02[[i]] <> "-" <> namat03[[j]] <> "-l1"},
 {namat02[[i]] <> "-" <> namat03[[j]] <> "-l2"},
 {namat02[[i]] <> "-" <> namat03[[j]] <> "-l3"} }

but is not working. Does anyone have any idea how this can be done?

$\endgroup$
  • $\begingroup$ @MarcoB Hi, yes there is a mistake, actually, I think it has to be <>"-l1", and yes a closing brace was missing. Thanks $\endgroup$ – mors Apr 3 at 14:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.