How to get the x,z coordinates for a specific y value out of my 3d surf plot?
6 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
hey folks. I struggle with the following problem. The 3 D plot you can see in the attached file shows 6 3D lineplots (vector based). Additionally there is a surfaceplot (consists of 3 matrices) which connects them lines to show how a sample behaves under a given temperature gradient above time....
The thing which makes me struggle is that I want to extract all the x and z data for a given Y value of 0 degree. the problem is, there is no exact 0 degree in the data used for the plot, its all around 0! So i should use a tolerance of 0.1 degree from 0. (I still dont know how to do that)
briefly said I want to form my 0 degro isotherm .....to see how the 0 degree front goes from bottom up through my sample.
What I want ist to find a way to ask for all the x and y values which are in the area between -0.1<0<0.1 degree.
I really hope anyone could help me somehow!
I know the code is not useful without the excel data it refers to....Its just to give u an impression how the Plot is build up:
figure(5);%Zeit_Wegaufnehmer/Tempfuehler--BOTTOMFROST
plot3(T,Pt100_BF1,Weg_BF1_abs);
hold on
plot3(T,Pt100_BF3,Weg_BF3_abs);
hold on
plot3(T,Pt100_BF4,Weg_BF4_abs);
hold on
plot3(T,Pt100_BF5,Weg_BF5_abs);
hold on
plot3(T,Pt100_BF6,Weg_BF6_abs);
hold on
plot3(T,Pt100_BF8,Weg_BF8_abs);
hold on
surf(Tm,D,C);
shading interp;
xlabel(' t [h]');
ylabel('Temperatur [°C]');
zlabel('Hebungen relativ zur Probenhoehe [mm]');
title('Hebungen/Temperaturfuehler/Zeit BOTTOMFROST')
grid on
colormap(jet(50));
colorbar;
legend('BF1/W1','BF3/W3','BF4/W4','BF5/W5','BF5/W6','BF8/W8','location','best');
2 Commenti
Walter Roberson
il 14 Ago 2020
Do we have to assume that the Tm, D, C data is no longer accessible, that only the graphics objects are accessible?
Risposte (1)
Walter Roberson
il 14 Ago 2020
sh = findobj(gcf, 'type', 'surface');
if isempty(sh)
error('No surface found')
end
sh = sh(1); %in case there were extra
recovered_Tm = sh.XData;
recovered_D = sh.YData;
recovered_C = sh.ZData;
mask = -0.1 <= recovered_Tm & recovered_Tm <= 0.1 & -0.1 <= recovered_D & recovered_D <= 0.1;
idx = find(mask);
selected_Tm = recovered_Tm(idx);
selected_D = recovered_D(idx);
selected_C = sh.ZData(idx);
The recovered* variables will be vectors of points, as the code does not assume that the grid is regular (or that it is aligned.)
In the case where the selection area would be rectangular, then
mask = -0.1 <= recovered_Tm & recovered_Tm <= 0.1 & -0.1 <= recovered_D & recovered_D <= 0.1;
shadow = any(mask,1);
first_col = find(shadow, 1, 'first');
last_col = find(shadow, 1, 'last');
shadow = any(mask,2);
first_row = find(shadow, 1, 'first');
last_row = find(shadow, 1, 'last');
selected_C = recovered_C(first_row:last_row, first_col:last_col);
7 Commenti
Walter Roberson
il 14 Ago 2020
selected_Tm = recovered_Tm(first_row:last_row, first_col:last_col);
selected_D = recovered_D(first_row:last_row, first_col:last_col);
selected_C = recovered_C(first_row:last_row, first_col:last_col);
Those is deliberately structured as a rectangular region, the bounding box on appropriate y values. The alternative is to extract just the matching points but in an unstructured way.
Vedere anche
Categorie
Scopri di più su Graphics Performance in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!