Borrar filtros
Borrar filtros

Extracting data tips from 3-D figure

1 visualización (últimos 30 días)
Tsuwei Tan
Tsuwei Tan el 30 de Jul. de 2019
Comentada: Tsuwei Tan el 30 de Jul. de 2019
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]);

Respuesta aceptada

KSSV
KSSV el 30 de Jul. de 2019
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 comentario
Tsuwei Tan
Tsuwei Tan el 30 de Jul. de 2019
Great! Fast and easy! Thank you so much KSSV!!!

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by