how do I extract and plot data points from a 2D mesh?
10 ビュー (過去 30 日間)
古いコメントを表示
I have a 2D mesh, with x and y coordinates and the colour represents the temperature. I want to plot the temperature at 3 points on the mesh so that i can compare the temperature at those points to the temperature at the same points on a different mesh that i have. The figure shows the mesh that i want the temperatures extracted from from. Thank you!
2 件のコメント
Star Strider
2022 年 1 月 6 日
The image is an (8x1) patch array, and I had to dig through several layers of properites even to find that information.
I’m not even going to attempt to deal with that since I have no idea what any of it represents. Provide the arrays instead, along with code and extensive documentation.
回答 (1 件)
Pavan Sahith
2023 年 12 月 16 日
Hello Leah,
I understand that you are trying to extract the values at specific points from a 2D mesh and compare it with the values of your 2D mesh.
To extract values from a 2D mesh, you can consider using “interp2” as one of the methods.
The “interp2” function is used for 2D interpolation. It interpolates the values at the specified points based on the provided mesh. So, It might help you.
You can refer to this sample code to understand the usage of “interp2”.
% Generate 2D mesh
x = linspace(0, 1, 11);
y = linspace(0, 1, 11);
[X, Y] = meshgrid(x, y);
Z = sin(X.*Y);
% Extract points and compare values
points = [0.2 0.3; 0.4 0.5; 0.6 0.7];
values = interp2(X, Y, Z, points(:,1), points(:,2));
disp(values);
Similarly, you can extract the values from another 2D mesh and use for comparison.
Please refer to this MathWorks documentation to know more about
Hope this helps.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Surface and Mesh Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!