2016-09-27 21 views
0

更新我的修改过的代码 - >错误的点被标记!看到颜色条! :)我怎样才能找出并标出我图中的最高值?

Input_Matrix = textread('Rainflow_Input1.txt') 
[zeilen,spalten]=size(Input_Matrix) 
x = Input_Matrix(:,1) 
y = Input_Matrix(:,2) 
z = Input_Matrix(:,3) 
colorbar('location','Manual', 'position', [0.93 0.1 0.02 0.81]); 

az = 0; 
el = 90; 
view(az, el); 


%scatter3(x,y,z,'filled')%Problem i dont know to make it filled 
view(0,90)% view from above !!!http://de.mathworks.com/help/matlab/ref/view.html 
a = 30;%markersize 
scatter3(x, y, z, a, z, 'filled'); 
view(0, 90) 
idx = find(max(z)) ; 
hold on 
plot3(x(idx),y(idx),z(idx),'*r') 
colorbar 
datacursormode on 

如何才能找出我图中的最高值?我想在我的图中标出它。因此,x yz值应该从最高值 - >z!显示。谢谢你的帮助。对此,我真的非常感激。

Input_Matrix = textread('Rainflow_Input1.txt') 
[zeilen,spalten]=size(Input_Matrix) 
x = Input_Matrix(:,1) 
y = Input_Matrix(:,2) 
z = Input_Matrix(:,3) 
colorbar('location','Manual', 'position', [0.93 0.1 0.02 0.81]); 

az = 0; 
el = 90; 
view(az, el); 


%scatter3(x,y,z,'filled')%Problem i dont know to make it filled 
view(0,90)% view from above !!!http://de.mathworks.com/help/matlab/ref/view.html 
a = 30;%markersize 
scatter3(x, y, z, a, z, 'filled'); 
view(0, 90) 
colorbar; 
datacursormode on 
; 

我输入:

-220.8 228 50045 
-222 201.6 50045 
-220.2 198 200176 
-224.4 196.8 200176 
-220.8 192 200176 
-221.4 190.8 50044 
-226.2 176.4 200176 
-199.2 156 50044 
-201.6 153.6 50045 
-219 147.6 50044 
-252.6 133.2 50044 
-210 129.6 200176 
-250.8 127.2 50044 
-201 126 50044 
-229.2 124.8 50044 
-183 123.6 200176 
-168 122.4 200176 
-275.4 118.8 200176 
-261 13.2 400352 
-259.8 13.2 200176 
-258.6 13.2 200176 
-257.4 13.2 290176 

回答

1

数据的最大值(的z我假设)将m在指数ind

[m,ind]=max(z); 

如果你担心有更多的比一个,你可以随时做

indexes=find(z==m); 

为了标记它们,在scatter3的呼叫完成hold on之后,并且仅以最大值数据调用scatter3,并且另一种格式例如'*'也许还有其他一些颜色

+0

好的...但我想在同一个窗口中显示这个数据,这一点应该标记为 – Lutz

+0

对不起@Ander Biguri你能发布代码吗?我是新的matlab,所以我的技能不好;) – Lutz

+0

这是代码... @LaraHäusl。如果它是散布的,你担心什么,你应该能够写出来,因为你已经写了1 scatter3 –