PDE Toolbox solution array along a line, to then find the mean value

3 ビュー (過去 30 日間)
A
A 2015 年 1 月 29 日
コメント済み: Bill Greene 2015 年 1 月 31 日
I'm have solved Poisson's equation for simple rectangular geometry using the PDE Toolbox. I exported the solution and mesh and now I want to find u along a line so that I can then find its average.
It is a rectangle with bottom boundary at y = -0.8 and x = -0.5 to 0.4. This is what I was trying to type in the command line:
F = pdeInterpolant(p,t,u);
x = -0.5:0.4;
y = -0.8;
uOut = evaluate(F,x,y)
But this only returns one value. I am looking for an array of values so that I can use mean(uOut) to find the average.
I also want to find the the mean normal component of u into the page at the same position.
Any help greatly appreciated.

採用された回答

Bill Greene
Bill Greene 2015 年 1 月 29 日
The evaluate function is returning only one value because the length of your x and y vectors is one. Maybe you want something like this:
F = pdeInterpolant(p,t,u);
n = 10;
x = linspace(-.5,.4,n);
y(1:n) = -.8;
uOut = evaluate(F,x,y)
to interpolate along the line between x=-.5 and x=.4
  2 件のコメント
A
A 2015 年 1 月 30 日
Thank you very much, this is exactly what I was looking for! Any chance you know how to calculate the normal component into the page (z -direction)? I can only find grad for x and y.
Bill Greene
Bill Greene 2015 年 1 月 31 日
PDE Toolbox is 2D only so it's functions won't be helpful in calculating a gradient in the z-direction.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeBoundary Conditions についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by