1
$\begingroup$

I need help with this. I want to label each one of the graphs generated by the values of the parameter t, but I'm unable to do it because the program takes the five graphs of the summatory with a parameter as one. I've already generated the graphs I desired, but labeling is just impossible for me. Could you please help me? Or what could be an option for what I want?

Here is the code:

Plot[Evaluate[{100, (200/Pi) \!\(
\*UnderoverscriptBox[\(\[Sum]\), \(n = 1\), \(9\)]\((\((\((1 - 
\*SuperscriptBox[\((\(-1\))\), \(n\)])\)/n)\) Exp[\(-\((
\*SuperscriptBox[\(n\), \(2\)])\)\) t] Sin[n*x])\)\) /. 
    t -> {0.05, 0.35, 0.6, 1, 1.5}}, {x, 0, Pi}], 
 PlotLegend -> {"t=0", "t=0.05", "t=0.35", "t=0.6", "t=1", "t=1.5"} , 
 AxesLabel -> {"x", "u"}, 
 PlotStyle -> {{Thick, Black}, {Thick, Cyan}, {Thick, 
    Magenta}, {Thick, Yellow}, {Thick, Orange}, {Thick, Green}}]

An image of what appears:

image

$\endgroup$
3
  • 1
    $\begingroup$ Please post your Mathematica code here,not the picture. $\endgroup$
    – cvgmt
    May 9, 2021 at 10:15
  • $\begingroup$ If you have version 9.0 or newer, replace PlotLegend with PlotLegends in your code. $\endgroup$
    – kglr
    May 9, 2021 at 11:30
  • $\begingroup$ I don't have it. I have the 8.0. Is there any form to do what I want? $\endgroup$
    – Fermath
    May 9, 2021 at 11:51

2 Answers 2

0
$\begingroup$
Needs["PlotLegends`"]

Plot[Evaluate[ Join[{100}, (200/Pi) \!\(
\*UnderoverscriptBox[\(\[Sum]\), \(n = 1\), \(9\)]\((\((\((1 - 
\*SuperscriptBox[\((\(-1\))\), \(n\)])\)/n)\) Exp[\(-\((
\*SuperscriptBox[\(n\), \(2\)])\)\) t] Sin[n*x])\)\) /. 
       t -> {0.05, 0.35, 0.6, 1, 1.5}]], {x, 0, Pi}, 
  PlotLegend -> {"t=0", "t=0.05", "t=0.35", "t=0.6", "t=1", "t=1.5"} , 
  AxesLabel -> {"x", "u"}, 
  PlotStyle -> {{Thick, Black}, {Thick, Cyan}, {Thick, 
        Magenta}, {Thick, Yellow}, {Thick, Orange}, {Thick, Green}}]

enter image description here

$\endgroup$
1
  • $\begingroup$ Wow, you're amazing! Thank you so much, really. :D $\endgroup$
    – Fermath
    May 10, 2021 at 3:52
0
$\begingroup$

Use Epilog->{Text[ commands ]}. As below:

Plot[Evaluate[{100, (200/Pi) \!\( \*UnderoverscriptBox[\(\[Sum]\), \(n = 1\), \(9\)]\((\((\((1 - \*SuperscriptBox[\((\(-1\))\), \(n\)])\)/n)\) Exp[\(-\(( \*SuperscriptBox[\(n\), \(2\)])\)\) t] Sin[n*x])\)\) /. t -> {0.05, 0.35, 0.6, 1, 1.5}}, {x, 0, Pi}], AxesLabel -> {"x", "u"}, PlotStyle -> {{Thick, Black}, {Thick, Cyan}, {Thick, Magenta}, {Thick, Yellow}, {Thick, Orange}, {Thick, Green}}, Epilog -> {Text["0.05", {2.8, 85}], Text["0.35", {2.5, 70}]}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.