How to Interpolate coordiantes and values of a surface plot

10 ビュー (過去 30 日間)
Jake
Jake 2023 年 1 月 17 日
編集済み: Matt J 2023 年 1 月 20 日
Hi,
I have a set of coordinates that creates a mesh - i.e. XYZ coordinates of a set of quadrilateral panels that creates a mesh, as shown below.
I also have the coordinates of the centroid of each panel. Moreover, I have a pressure value at each of those centroids. I have attached the mesh coordiante file herewith (needs to be mirrored).
I'm not sure if I'm doing a good job explaining the problem, so I followed a rather graphical approach to show what I mean.
Now, I want to find coordinates (XYZ) at a particular XZ plane. For instance, say, I have a plane x = -3.0, as shown. I would like to find the coordinates XYZ on the surface that matches the said x values. Further, I want to find the interpolated pressure value too, that are acting along that specified x values.
How can I achieve this?
Thank you in advance!

回答 (1 件)

Matt J
Matt J 2023 年 1 月 20 日
編集済み: Matt J 2023 年 1 月 20 日
You can build a scatteredInterpolant object. Then you can interpolate anywhere you wish.
load('mesh_coordinates.mat');
centroids=cell2mat(cellfun(@mean,mesh_coordinates,'un',0));
F=scatteredInterpolant(centroids(:,1:2), centroids(:,3));
x=-0.3;
[ymin,ymax]= bounds(centroids(:,2));
y=linspace(ymin,ymax,100);
z=F({x,y});
plot(y,z,'o-'); xlabel y; ylabel z; title 'Cross Section @x=-0.3'
  1 件のコメント
Matt J
Matt J 2023 年 1 月 20 日
編集済み: Matt J 2023 年 1 月 20 日
For the pressure value interpolation, you would do the same thing, but interpolatng pressure instead of z.

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by