フィルターのクリア

Extracting data tips from 3-D figure

1 回表示 (過去 30 日間)
Tsuwei Tan
Tsuwei Tan 2019 年 7 月 30 日
コメント済み: Tsuwei Tan 2019 年 7 月 30 日
Please download long_lati_depth.mat
And run the code.
May I ask how to automatically extract the data when the line A to B intersecting the isobath line which is one meter increment like [-74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84] ?
The extracted data should be a 3D matrix with selected longitude, latitude and depth.
I am trying to find the water depth change with range from A to B, with one meter increment. Thanks!
clear;clc;close all;figure(1);load('long_lati_depth.mat','long','lati','depth')
contour(long,lati,depth,[-74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84],'ShowText','on')
hold on
% A
plot3(-73.0497,39.0232,0,'ko','LineWidth',5);text(-73.0497,39.0232,'\leftarrow A','Color','red')
% B
plot3(-73.0623,39.0542,0,'ko','LineWidth',5);text(-73.0623,39.0542,'\leftarrow B','Color','red')
images.roi.Line(gca,'Position',[-73.0623 39.0542;-73.0497 39.0232]);

採用された回答

KSSV
KSSV 2019 年 7 月 30 日
clear;clc;close all;
figure(1);
load('long_lati_depth.mat','long','lati','depth')
contour(long,lati,depth,[-74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84],'ShowText','on')
hold on
% A
A = [-73.0497,39.0232] ;
plot3(-73.0497,39.0232,0,'ko','LineWidth',5);
text(-73.0497,39.0232,'\leftarrow A','Color','red')
% B
B = [-73.0623,39.0542] ;
plot3(-73.0623,39.0542,0,'ko','LineWidth',5);
text(-73.0623,39.0542,'\leftarrow B','Color','red')
% images.roi.Line(gca,'Position',[-73.0623 39.0542;-73.0497 39.0232]);
% Get line for AB
x = [A(1) B(1)] ;
y = [A(2) B(2)] ;
p = polyfit(x,y,1) ;
xi = linspace(x(1),x(2)) ;
yi = polyval(p,xi) ;
plot(xi,yi,'r')
% Get depth for xi,yi
zi = interp2(long,lati,depth,xi,yi) ;
iwant = [xi; yi ;zi]
  1 件のコメント
Tsuwei Tan
Tsuwei Tan 2019 年 7 月 30 日
Great! Fast and easy! Thank you so much KSSV!!!

サインインしてコメントする。

その他の回答 (0 件)

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by