Plot two solutions of PDE from different space.

2 visualizaciones (últimos 30 días)
Thanasis Hou
Thanasis Hou el 5 de Abr. de 2017
Respondida: Alan Weiss el 5 de Abr. de 2017
Hello,
I have a very specific problem which I cannot solve it. I solved a PDE(1D, for instance u1, with the pdepe solver. The geometry was from 0 to 1 with 41 mesh points. I make the same one from 1 to 2 with 100 mesh points. The solution was u2.
I want to plot the solutions as one with the difference that I have a discontinuity at x point. However, I do not want a graph such as the two branch functions. I want as one with a vertical line in the point of discontinuous. I attached an image from the example pdex5 which MatLab provides.
I will be grateful for some ideas.

Respuestas (1)

Alan Weiss
Alan Weiss el 5 de Abr. de 2017
I suppose that the first mesh points are in a vector x1, and the second set of mesh points is in a vector x2. I also assume that the discontinuity is at x = 1.
plot(x1,u1,'r')
hold on
plot(x2,u2,'b')
plot([1,1],[u1(41),u2(1)],'k')
hold off
xlabel('x')
ylabel('u')
Of course, you don't have to have different colors for each part of the plot.
If I misunderstood what you were asking, please ask again.
Alan Weiss
MATLAB mathematical toolbox documentation

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by