I need help with transect plot

조회 수: 17 (최근 30일)
pedro rodrigo
pedro rodrigo 2019년 5월 27일
편집: pedro rodrigo 2019년 6월 3일
Hello MatLabers, I am new to the field and I am full of doubts about how I could face this challenge in the best possible way. I have a series of oceanographic data. And I would like to profile a transect with temperature data.
I have had a lot of trouble with the length of them. But let's go to what matters, on the Y axis, I have a maximum depth of 30 meters, and on the X axis, from 0 to 2000 meters. I have 5 measurement points (200m, 600m, 1000m, 1400m and 1800m). How can I partition my plot to set the position of these 5 points?
WHAT I HAVE
WHAT I WHANT
I thank you in advance for any guidance to solve this problem!

답변 (1개)

menia
menia 2019년 5월 31일
편집: menia 2019년 5월 31일
  댓글 수: 1
pedro rodrigo
pedro rodrigo 2019년 6월 3일
편집: pedro rodrigo 2019년 6월 3일
I've made some progress in my goal, but I still need to work on two approaches:
1 - How can I fill in the blanks of the interpolated data while maintaining the current positions?
2 - How can I use 'area' to fill my bathymetry data, being I flip the direction of the y-axis (like negative area?)
Thank you in advance for any direction you can help me!
%x = x.' % invert axis
%new life
clear;
close all;
clc;
%Summon data
data = xlsread('pernada1.xls');
%Create all vectors with the same size
%depth in each point
d1 = data(:,1);
d2 = data(:,3);
d3 = data(:,5);
d4 = data(:,7);
d5 = data(:,9);
dall = [d1;d2;d3;d4;d5];
%temp in each point
t1 = data(:,2);
t2 = data(:,4);
t3 = data(:,6);
t4 = data(:,8);
t5 = data(:,10);
tall = [t1;t2;t3;t4;t5];
%Aternative to fill the bottom of that matrix with NaN values
Nmax = max([length(d1),length(d2),length(d3),length(d4),length(d5)]);
E = 5; % number of stations
T = NaN( Nmax , E ); % create a matrix filled with NaN values
T( 1:length(t1) , 1) = t1; % fill in the first column of the matrix with t1
T( 1:length(t2) , 2) = t2; % fill in the second column of the matrix with t2
T( 1:length(t3) , 3) = t3; % fill in the second column of the matrix with t3
T( 1:length(t4) , 4) = t4; % fill in the second column of the matrix with t4
T( 1:length(t5) , 5) = t5; % fill in the second column of the matrix with t5
%Distribution of functions in the plot
x = 200:400:2000; % Define x vector of station locations
z = d4; % Define z vector of max depths
%z = d4; % Define z vector of max depths
figure; % Create new figure window
pcolor(x,z,T); % Create plot of temperature
colorbar;
hcb=colorbar;
title(hcb,'Temperature');
%contourf(x,z,T,'ShowText','on'); %countourf with labels
shading interp; % Remove visible mesh and set colours to be interpolated
set(gca,'ydir','reverse'); % Flip the direction of the y-axis
% Setting axis
xlim([0,2000]);
ylim([0,30]);
hold on
%Bathymetry with 127 values
%bathymetry = [0 0.4 0.8 1.01 1.33 1.66 1.80 2.33 2.83 2.98 3.02 3.15 3.29 3.53 3.83 4.53 4.67 4.99 5.83 6.37 7.44 8.53 9.79 9.82 9.97 10.22 10.86 11.62 12.48 12.87 13.92 14.29 14.72 15.57 15.92 16.16 16.88 17.10 17.67 18.08 18.45 19.22 19.72 20.09 20.62 21.3 21.42 21.97 22.42 22.94 23.11 23.34 23.8 24.02 24.21 24.53 24.86 25.01 25.12 25.28 25.53 25.74 25.99 26.11 26.27 26.36 26.45 26.57 26.61 26.72 26.91 26.61 27.02 27.08 27.11 27.18 26.78 26.18 25.75 25.11 24.76 24.48 24.33 24.29 24.12 24.08 23.99 23.87 23.72 23.66 23.59 23.27 23.08 23.01 22.9 22.42 22.14 21.87 18.79 17.55 16.79 15.92 15.21 14.09 13.45 12.09 11.77 10.89 10.57 10.34 10.29 10.17 9.94 9.79 8.62 7.29 6.78 5.67 4.79 3.98 2.79 2.11 1.25 0.4 0.2 0.1 0];
%bathymetry = bathymetry.'
%plot(x, bathymetry)
%Transect with 150 values
%transect = [1:13.33:2000];
%Transect with 127 values
transect = [1:15.748:2000];
%Bathymetry with 150 values
%bathymetry = [0 0.4 0.8 1.01 1.33 1.66 1.80 2.33 2.53 2.83 2.98 3.02 3.15 3.29 3.53 3.83 4.53 4.67 4.99 5.53 5.83 6.37 7.44 8.53 9.73 9.79 9.82 9.97 10.02 10.22 10.86 11.62 11.92 12.48 12.87 13.92 14.29 14.38 14.72 15.57 15.92 16.02 16.16 16.88 17.10 17.32 17.67 18.08 18.45 18.86 19.22 19.72 20.09 20.62 20.88 21.3 21.42 21.65 21.97 22.2 22.42 22.94 23.11 23.34 23.8 24.02 24.21 24.53 24.86 25.01 25.12 25.28 25.53 25.74 25.99 26.11 26.27 26.36 26.45 26.57 26.61 26.72 26.91 26.61 27.02 27.08 27.11 27.18 26.78 26.54 26.18 25.75 25.11 24.76 24.56 24.48 24.33 24.29 24.17 24.12 24.08 23.99 23.87 23.72 23.66 23.59 23.39 23.27 23.08 23.01 22.9 22.42 22.14 21.87 20.4 18.79 17.55 16.79 15.92 15.21 14.09 13.45 12.09 11.77 11.01 10.89 10.57 10.34 10.29 10.17 9.94 9.79 8.62 7.29 6.78 5.67 4.79 3.98 2.79 2.11 1.25 0.4 0.3 0.2 0.1 0.1 0 0 0 0];
%Bathymetry with 127 values
bathymetry = [0 0.4 0.8 1.01 1.33 1.66 1.80 2.33 2.53 2.83 2.98 3.02 3.15 3.29 3.53 3.83 4.53 4.67 4.99 5.83 6.37 7.44 8.53 9.73 9.79 9.82 9.97 10.02 10.22 10.86 11.62 11.92 12.87 13.92 14.29 14.72 15.57 15.92 16.02 16.16 16.88 17.10 17.32 17.67 18.08 18.45 18.86 19.22 19.72 20.09 20.62 20.88 21.3 21.42 21.65 21.97 22.2 22.42 22.94 23.11 23.34 23.8 24.02 24.21 24.53 24.86 25.01 25.12 25.28 25.53 25.74 25.99 26.11 26.27 26.36 26.45 26.57 26.61 26.72 26.61 26.91 27.02 27.08 27.11 27.18 26.78 26.54 26.18 25.75 25.11 24.76 24.56 24.48 24.33 24.29 24.17 24.12 24.08 23.99 23.87 23.72 23.66 23.59 23.39 23.27 23.08 23.01 22.9 22.42 22.14 21.87 20.4 18.79 17.55 16.79 15.21 13.45 11.01 9.94 8.62 4.79 3.98 2.11 1.25 0.3 0.1 0];
bathymetry = bathymetry.'; %give vector pattern orientation
transect = transect.'; %give vector pattern orientation
plot(transect, bathymetry)
%area(transect, bathymetry)
title ('Transect almost there!!')
xlabel ('Transect')
ylabel ('Depth')
untitled.jpg

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Oceanography and Hydrology에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by