Filter löschen
Filter löschen

How to plot every cell of a cell array onto a map projection using MAP library?

1 Ansicht (letzte 30 Tage)
Hello,
I have a code that I plot some arrows showing the displacement of gps points onto a map projection. Then I defined a grid and plot onto this map and calculated the density of the grids and the pairwise distances between every point belonging to the same grid.
Then I needed to check if those distances have normal distribution or not. So, I calculated mean, standard deviation and normal & lognormal probability density functions.
In the code below, density of the grids (which grid contain what amount of data) and the abs(mean-median) value of the distances are plotted onto the map projection.
I am trying to plot normal and lognormal probability density functions for every cell of a cell array onto this map projection like I did for density and mean-median. How can I do that with normal distribution pdf - ND{} and lognormal distribution pdf - LD{}? Because they are cell arrays, I could not achieve.
The thing I seek to see is the difference between normal and lognormal distributions in color. I will compare them to understand the normality of my data.
To understand what I am trying to plot, please examine the code and figure below. Thanks a lot from now.
clear all;
addpath('D:\Desktop\BOUN\JOB\Slip_Rates\Slip_Data\MAP');
% MAP PROJECTION
LAT1=39; LAT2=42; LON1=29; LON2=41; sf = 1;
subplot(2,2,1);
m_proj('albers equal-area','lat',[LAT1 LAT2],'long',[LON1 LON2],'rect','on');m_gshhs_h('color',[.5 .5 .5]);hold on;
m_grid('linewi',1,'linest','none','tickdir','in','fontsize',10);
% DATA
DATA = load('all_velocities.txt'); lon1=DATA(:,1); lat1=DATA(:,2); ve1=DATA(:,3); vn1=DATA(:,4);
% GRIDDING
dLO = .5*2; dLA = .3636*2;
lon = [LON1:dLO:LON2];
lat = [LAT1:dLA:LAT2];
nlat = length(lat); nlon = length(lon); DIST = cell(nlat, nlon);
% DISTANCE CALCULATION
for i = 1:nlat
for j = 1:nlon
ind = find(abs(lat1-lat(i))<dLA/2 & (abs(lon1-lon(j))<dLO/2));
DENSITY(i,j) = length(ind); % DENSITY OF THE GRIDS
points = [reshape(lat1(ind),[],1), reshape(lon1(ind),[],1)];
P{i,j} = points; % ELEMENTS IN EACH GRID
DIST{i,j} = pdist(points, 'euclidean'); % PAIRWISE DISTANCE BETWEEN ELEMENTS IN EACH GRID
end
end
% PLOTTING DENSITY OF THE GRIDS ONTO THE PROJECTION
m_pcolor(lon-dLO/2,lat-dLA/2,DENSITY);
m_quiver(lon1,lat1,sf.*ve1,sf.*vn1,1,'w','filled','AutoScale','off','linewidth',1.5);
for i = 1:nlat
for j = 1:nlon
DDIST = (DIST{i,j});
SDIST(i,j) = std(DIST{i,j});
MEDIST(i,j) = median(DIST{i,j});
MDIST(i,j) = mean(DIST{i,j});
if length(DIST{i,j})>1
LD{i,j} = 1/(sqrt(2*pi)*std(DIST{i,j}))*exp(-((log(DIST{i,j})-mean(DIST{i,j})).^2)/(2*(std(DIST{i,j}).^2)));
ND{i,j} = 1/(sqrt(2*pi)*std(DIST{i,j}))*exp(-((DIST{i,j}-mean(DIST{i,j})).^2)/(2*(std(DIST{i,j}).^2)));
end
end
end
% PLOTTING abs(MEAN-MEDIAN) OF THE GRIDS ONTO THE MAP PROJECTION
subplot(2,2,2);
m_proj('albers equal-area','lat',[LAT1 LAT2],'long',[LON1 LON2],'rect','on');m_gshhs_h('color',[.5 .5 .5]);hold on;
m_grid('linewi',1,'linest','none','tickdir','in','fontsize',10);
C = abs(MDIST - MEDIST); m_pcolor(lon-dLO/2, lat-dLA/2, C);
m_quiver(lon1,lat1,sf.*ve1,sf.*vn1,1,'w','filled','AutoScale','off','linewidth',1.5);

Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by