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!