Hello everyone.
I have a vector which contains 81 realizations of a stochastic process. I need to plot them together to see the differences. Until now I have written my code as
g1 = ListPlot[{matRealizations[[1]], matRealizations[[2]],
matRealizations[[3]], matRealizations[[4]], matRealizations[[5]],
matRealizations[[6]], matRealizations[[7]], matRealizations[[8]],
matRealizations[[9]], xvsyMean},
Joined -> {True, True, True, True, True, True, True, True, True,
False}]
However, with 81 realizations this is unfeasible.
I have tried
g1 = ListPlot[{matRealizations[[1 ;; 5]], Joined -> {True}}]
but an error appears.
Can someone please tell me if there is a way for me to plot all 81 realizations without having to write matRealizations[[i]], eighty one times?
Thank you very much.
Jaime.
Hi Jamie,
What is the structure of matRealizations? If it is a list of numbers or a list of lists of points then this should work.
ListPlot[matRealizations, Joined -> True]
If not, you can always generate the list using Table.
ListPlot[Table[matRealizations[[i]], {i, 81}], Joined -> True]
trounev
(Alexander Trounev)
September 10, 2019, 3:21pm
3
There are many ways, I will show one of them. Let a random process be described by a function
matRealizations =
Table[Sin[RandomReal[-1, 1] t + RandomReal[]], {81}];
You can display them all together or selectively
Show[Table[
Plot[matRealizations[[i]], {t, -Pi, Pi}, PlotStyle -> Hue[i/81],
PlotRange -> {-1, 1}], {i, 1, 81, 1}]]
{Show[Table[
Plot[matRealizations[[i]], {t, -Pi, Pi}, PlotStyle -> Hue[i/81],
PlotRange -> {-1, 1}], {i, 1, 7, 1}]],
Show[Table[
Plot[matRealizations[[i]], {t, -Pi, Pi}, PlotStyle -> Hue[i/81],
PlotRange -> {-1, 1}], {i, {1, 5, 61, 70}}]]}
Hello!
I have tested your solution and the first one works finely.
Thank you very much.
Regards.
Jaime.