Question about two dimensional PCA analysis
1 view (last 30 days)
Show older comments
Hello everybody. I have a file containing wind data in directions S-N and W-E for some places and at some times denoted by latitudes and longitudes. I have written the following code:
if true
clear all
close all
clc
ncdisp('solicitud_31082016_00_12-60_ext.nc')
longitud = ncread('solicitud_31082016_00_12-60_ext.nc', 'longitude');
latitud = ncread('solicitud_31082016_00_12-60_ext.nc', 'latitude');
numero = ncread('solicitud_31082016_00_12-60_ext.nc', 'number');
tiempo = ncread('solicitud_31082016_00_12-60_ext.nc', 'time');
mat_u = ncread('solicitud_31082016_00_12-60_ext.nc', 'u');
mat_v = ncread('solicitud_31082016_00_12-60_ext.nc', 'v');
mat_t = ncread('solicitud_31082016_00_12-60_ext.nc', 't');
latitudes = size (mat_u, 2);
longitudes=size (mat_u, 1);
for contador_latitudes = 1:latitudes
for contador_longitudes =1: longitudes
U =(squeeze(mat_u(contador_longitudes,contador_latitudes,:,:)))';
V =(squeeze(mat_v(contador_longitudes,contador_latitudes,:,:)))';
module=sqrt(U.^2+V.^2);
t=size(V,1);
num_realizations=size(V,2);
Autocovariance=cov(module');
[eigenvectors,eigenvalues]=eig(Autocovariance);
[coeff, score, latent, tsquared, explained, mu]=pca(module,'Centered',false);T=score*coeff';TT=T';
useful_pcs=9;
coeff_global(:,:,contador_latitudes, contador_longitudes)=coeff;
score_global(:,:,contador_latitudes, contador_longitudes)=score;
tsquared_global(:,:,contador_latitudes, contador_longitudes)=tsquared;
explained_global(:,contador_latitudes, contador_longitudes)=explained;
mu_global(:, contador_latitudes, contador_longitudes)=mu;
end
end
end
However, I don't want to know just the module of the wind velocity for all these places at all these times. I want to know what is the relationship between both directions and not just the variation of the module of the wind.
Can someone please tell me how to do that?
Edit: I want to see not the unidimensional eigenvectors, instead I want to visualize a surface with the eigenvectors in both directions.
Thanks
0 Comments
Answers (0)
See Also
Categories
Find more on Dimensionality Reduction and Feature Extraction in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!