Plot two solutions of PDE from different space.

조회 수: 1 (최근 30일)
Thanasis Hou
Thanasis Hou 2017년 4월 5일
답변: Alan Weiss 2017년 4월 5일
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