Plot solution of pde toolbox on a line (or submanifold)

7 ビュー (過去 30 日間)
Alessandro
Alessandro 2012 年 10 月 31 日
I'm using the pde toolbox to solve a certain elliptic equation in 2D.
Solution is fine, although I do need to plot it along a given line, i.e. to cut a planar slice from the 3D mesh representing the solution.
I can't figure out a way that smartly involves the toolbox functions.
Any help appreciated.

採用された回答

Bill Greene
Bill Greene 2012 年 11 月 2 日
Hi,
Here is one way to create such a plot. Assume you have the point matrix created by the PDE Toolbox mesher, p, and a solution vector, u. The function below will create a plot of that solution along a line defined by the x and y locations of the two end points. My example is for a solution on a unit square and I want a plot along the line (0,.5) to (1,.5). I want to include 25 points in the plot. As you can see, the real work is being done by the TriScatteredInterp function from core MATLAB.
plotAlongLine(p, u, [0,.5], [1,.5], 25);
function plotAlongLine(p, u, xy1, xy2, numpts)
x = linspace(xy1(1),xy2(1),numpts);
y = linspace(xy1(2),xy2(2),numpts);
F = TriScatteredInterp(p(1,:)', p(2,:)', u);
uxy = F(x,y);
figure; plot(x, uxy);
end
Bill
  1 件のコメント
Alessandro
Alessandro 2012 年 11 月 5 日
Perfectly working! thanks!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGeometry and Mesh についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by