2016-09-27 38 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 –

相關問題