# Plot a solution of DSolveValue

Posted 1 year ago
1951 Views
|
|
2 Total Likes
|
 Hello, please I calculated the solution of a particular heat equation with control, now I have the solution but I can't plot it if someone can help me please: (* this first part is just for building the control, you can ignore it*) T = 2 \[Pi]; l = 7 \[Pi]/4; a = 1/100; w1 = Sin; (*Définit la fonction indicatrice*) indicator[x_] := Piecewise[{{1, 0 < x < \[Pi]/2}}, 0]; (*Semi groupe S[f,t][x]*) S[t_, f_, x_] := Sum[ Exp[- t n^2] Integrate[f[s] Sin[s n], {s, 0, \[Pi]}] Sin[x n], {n, 5}] v1[x_] := w1[x]; L[t_, x_] := S[T - t, v1, x]; Q[x_] := indicator[x] Integrate[L[s, x]^2, {s, T - l, T}]; g1[x_] := a v1[x] + Q[x]; g2[t_, x_] := indicator[x] v1[x] L[t, x]; u[t_, x_] := g2[t, x]/g1[x]; Now that we have our control u, we pass to the calculation of solution of our heat equation homogen = D[f[x, t], t] - D[f[x, t], {x, 2}] - indicator[x] u[x, t] == 0; (*données initiales propres *) ic = {f[x, T - l] == 0}; (* Condition aux bord de Dirichlet*) bc = {f[0, t] == 0, f[\[Pi], t] == 0}; (*résolution analytique de l'équation *) sol1 = DSolveValue[{homogen, ic, bc}, f[x, t], {x, 0, \[Pi]}, {t, T - l, T}] 1) now we have the solution I want to plot the solution when t = T (fix) and x varies between 0 and $\pi$? Answer
 I would do it this way: sol1 = NDSolveValue[{homogen, ic, bc}, f, {x, 0, \[Pi]}, {t, T - l, T}] Plot[sol1[x, T], {x, 0, Pi}] Answer