Plot two solutions of PDE from different space.

1 次查看(过去 30 天)
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.

回答(1 个)

Alan Weiss
Alan Weiss 2017-4-5
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

类别

Help CenterFile Exchange 中查找有关 Geometry and Mesh 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by