0
$\begingroup$

The limits of the graph should be (0,1) on the x and y axis but mine is [1,11] on x-axis and [0,7] on the y axis. Any idea what to do?

ListLinePlot[
  Table[
    2 π 
      (Sum[
         2 E^(-n^2 π^2 t) π  *  
           NIntegrate[E^(-((1 - Cos[π y])/(2 π))) Cos[n π y], {y, 0,1}] * 
             n Sin[n π x], 
         {n, 1, 10}] / 
           (NIntegrate[E^(-((1 - Cos[π y])/(2 π))) , {y, 0, 1}] + 
              Sum[
                2 NIntegrate[
                    E^(-((1 - Cos[π y])/(2 π))) Cos[n π y], {y, 0, 1}] * 
                    E^(-n^2 π^2 t)* Cos[n π x], 
                {n, 1, 10}])), 
    {t, {0.3, 0.1, 0.05, 0.01, 0}}, 
    {x, {0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1}}]]

enter image description here

$\endgroup$
0
$\begingroup$

That is because the table you made does not depend on x as

{{x ,f[x, t]},...}. 

It is like

{ {f [xi , t1 ], ...} , { f [ xi , t2 ] , ...} , ... , { f [ xi , t5 ] , ... }  }. 

so list line plot take the position number of the function's value in the list to be its x axis. That is why it starts from 1 and goes to 11 on X axis. So modify as follows:

ListLinePlot[
 Table[{x, 
   2 \[Pi] (Sum[
       2 E^(-n^2 \[Pi]^2 t) \[Pi]*
        NIntegrate[
         E^(-((1 - Cos[\[Pi] y])/(2 \[Pi]))) Cos[n \[Pi] y], {y, 0, 
      1}]*n Sin[n \[Pi] x], {n, 1, 
    10}]/(NIntegrate[
     E^(-((1 - Cos[\[Pi] y])/(2 \[Pi]))), {y, 0, 1}] + 
    Sum[2 NIntegrate[
       E^(-((1 - Cos[\[Pi] y])/(2 \[Pi]))) Cos[n \[Pi] y], {y, 0, 
        1}]*E^(-n^2 \[Pi]^2 t)*Cos[n \[Pi] x], {n, 1, 
      10}]))}, {t, {0.3, 0.1, 0.05, 0.01, 0}}, {x, 0, 1, .1}], 
 PlotRange -> {{0, 1}, {0, 1}}]

plot1

you can change the option PlotRange of the plot from

PlotRange->{{0,1},{0,1}}

to

PlotRange->{{0,1},All}

or

PlotRange->All

to get

plot2

| improve this answer | |
$\endgroup$
  • $\begingroup$ @NavinRajil thank you, your answer was helpful $\endgroup$ – g.Jo Feb 11 '18 at 1:16

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