How to get the x,z coordinates for a specific y value out of my 3d surf plot?

6 visualizzazioni (ultimi 30 giorni)
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
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?
Lorenz Doerwald
Lorenz Doerwald il 14 Ago 2020
Modificato: Lorenz Doerwald il 14 Ago 2020
Tm, D,and C are matrices that combine the values from the single line plots. they basically form matrices like the following example:
Tm= [T;T;T;T;T;T]; basically the same timesteps as in each time vector, assembled to a matrix to make the surfplot possible. might be complicated made by myself, but I am a bloody beginner here ;)
same goes for D, which presents the matrix of Temperatures and C for the position of the heigth ...
and yes, all the data is still accessible!
%Erstellen der Matrizen
a1=[Weg_TF1_abs]'; %Weg/Zeit_TF
a3=[Weg_TF3_abs]';
a4=[Weg_TF4_abs]';
a5=[Weg_TF5_abs]';
a6=[Weg_TF6_abs]';
a8=[Weg_TF8_abs]';
A=[a1;a3;a4;a5;a6;a8];
%------------------
b1=[Pt100_TF1]'; %Temp/Zeit_TF
b3=[Pt100_TF3]';
b4=[Pt100_TF4]';
b5=[Pt100_TF5]';
b6=[Pt100_TF6]';
b8=[Pt100_TF8]';
B=[b1;b3;b4;b5;b6;b8];
%------------------
c1=[Weg_BF1_abs]'; %Weg/Zeit_BF
c3=[Weg_BF3_abs]';
c4=[Weg_BF4_abs]';
c5=[Weg_BF5_abs]';
c6=[Weg_BF6_abs]';
c8=[Weg_BF8_abs]';
C=[c1;c3;c4;c5;c6;c8];
%------------------
d1=[Pt100_BF1]'; %Temp/Zeit_BF
d3=[Pt100_BF3]';
d4=[Pt100_BF4]';
d5=[Pt100_BF5]';
d6=[Pt100_BF6]';
d8=[Pt100_BF8]';
D=[d1;d3;d4;d5;d6;d8];
%Vorstufe zum 3D surfacePlot = meshgrid
%meshgrid _Topfrost
%Umwandlung des Zeitvektors in Matrix derselben Dimension wie A,B,C,D
t1=[T]';
t3=[T]';
t4=[T]';
t5=[T]';
t6=[T]';
t8=[T]';
Tm=[t1;t3;t4;t5;t6;t8];

Accedi per commentare.

Risposte (1)

Walter Roberson
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
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.
Lorenz Doerwald
Lorenz Doerwald il 14 Ago 2020
thank you, that is already very helpful.
But I just thought about another way, conerning loops.
how would I try to get the following idea into matlab?

Accedi per commentare.

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!

Translated by