How to display minimum vaue of a Surface z-axis.
5 ビュー (過去 30 日間)
古いコメントを表示
I have drew a trisurf with 100 values in each x,y and z variable, and I want to display the least 10 data values of z on the surface over the location of the points .
0 件のコメント
回答 (2 件)
Image Analyst
2012 年 12 月 21 日
編集済み: Image Analyst
2012 年 12 月 21 日
sortedValues = sort(z(:), 'ascend');
fprintf('%f\n', sortedValues(1:10));
Use text() if you want to display some message above the data point.
1 件のコメント
Image Analyst
2012 年 12 月 21 日
編集済み: Image Analyst
2012 年 12 月 21 日
I noticed your attempt at using text below:
text(Xmin+xgap, Ymin+ygap, Zmin+zgap);
like I suggested, but where is the message you want to display? You didn't supply it. Try creating a message like I said:
message = sprintf('Zmin=%.2f', Zmin); % Create string for the Zmin point.
text(Xmin+xgap, Ymin+ygap, Zmin+zgap, message);
Matt Kindig
2012 年 12 月 21 日
編集済み: Matt Kindig
2012 年 12 月 21 日
You can do this using text() function. Something like this:
%Xval, Yval, and Zval are your MxN matrices used to make the surface.
Zmin = sort(Zval(:), 'descend'); %sort z decreasing
Zmin = Zmin(1:10); %10 smallest z values
pos = ismember(Zval, Zmin); %location of Z values
Xmin = reshape(Xval(pos),[],1);
Ymin = reshape(Yval(pos),[],1);
xgap = 1; ygap = 1; zgap = 1; %adjust to get desired spacing of label from point.
text( Xmin+xgap, Ymin+ygap, Zmin+zgap);
2 件のコメント
Matt Kindig
2012 年 12 月 21 日
編集済み: Matt Kindig
2012 年 12 月 21 日
Or maybe I misunderstood your question. Are you asking how to plot these points? In that case, just use plot3():
hold on;
plot3( Xmin, Ymin, Zmin, 'o');
参考
カテゴリ
Help Center および File Exchange で Surface and Mesh Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!