how do I extract and plot data points from a 2D mesh?
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Star Strider
am 6 Jan. 2022
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.
Antworten (1)
Pavan Sahith
am 16 Dez. 2023
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 Kommentare
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!