como llamar archivos de entrada
Publicado por DULCE (23 intervenciones) el 10/07/2020 09:59:08
Hola! soy nueva usando matlab y me pasaron un programa para resolver funcione sortogonales, entiendo lo que hace el programa , pero me frustra no saber como cargar los datos que quiero estudiar. En este caso x es un archivo de las series de tiempo (trabajo con datos metereologicos).
cada archivo contiene latitud, longitud y temperatura. Espero me puedan ayudar para saber como llamar al archivo .mat , a continuación pongo el codigo que tengo.
cada archivo contiene latitud, longitud y temperatura. Espero me puedan ayudar para saber como llamar al archivo .mat , a continuación pongo el codigo que tengo.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
function [covmat, eofvec, eofval, eofvar, power, phase, powert, phaset] = eof(x, iop)
%______________________________________________________________________________
%
%[COVMAT, EOFVEC, EOFVAL, EOFVAR, MODES] = EOF(X, 0) real case
%
%[COVMAT,EOFVEC,EOFVAL,EOFVAR,POWER,PHASE,POWERT,PHASET] = EOF(X, [1 or 2]) complex case
%______________________________________________________________________________
%
% EOF
% Calculates Empirical Orthogonal Functions
%
%
% X : Time Series Matrix
% IOP : Real(iop = 0) or Complex (iop = 1, 2) EOF's
%
% COVMAT : Real or Complex Covariance Matrix.
% EOFVEC : Real or Complex Eigenvectors Matrix (N by N).
% EOFVAL : Real or Complex Eigenvalues Vector (N).
% EOFVAR : Real or Complex Relative Variance Vector (N).
% POWER : Spatial Power Functions Matrix (N by N).
% PHASE : Spatial Phase Functions Matrix (N by N).
% POWERT : Temporal Power Functions Matrix (M by N).
% PHASET : Temporal Phase Functions Matrix (M by N).
%
%
% JJSP 1995
%
% help when called without input arguments
if nargin == 0
help eof
return
end
tfac = 0.50 / 86400.00; rfac = 180.0 / pi;
covmat = []; eofvec = []; eofval = []; eofvar = []; power = [];
phase = []; powert = []; phaset = [];
x = detrnd(x);
[n, m] = size(x);
ind_nan = find(isnan(x) == 1);
if ~isempty(ind_nan)
x(ind_nan) = zeros(size(ind_nan));
end
%
% IOP = 0 Real Covariance Matrix and EOF's
%
if iop == 0
covmat = (1 / n) * x' * x;
[eofvec, eofval, eofvar] = reig(covmat);
powert = []; phase = []; phaset;
power = x * eofvec
size(power)
%
% IOP = 1 Complex Covariance Matrix and CEOF's
%
elseif iop == 1
x = hilbert(x);
covmat = (1 / n) * x' * x;
[eofvec, eofval, eofvar, power, phase] = cpxeig(covmat);
y = x * eofvec;
powert = abs(y);
phaset = angle(y);
phaset = unwrap(phaset) * rfac;
clear y
%
% IOP = 2 Complex Covariance Matrix and CEOF's
%
elseif iop ==2
x = x(:, 1: 2: (n-1)) + i .* x(:, 2: 2: n);
[n, m] = size(x);
covmat = (1 / n) * x' * x;
[eofvec, eofval, eofvar, power, phase] = cpxeig(covmat);
y = x * eofvec;
powert = abs(y);
phaset = angle(y);
phaset = unwrap(phaset) * rfac;
clear y
[xmax, ind] = max(power);
[n, m] = size(power);
for k = 1: m
power(:, k) = power(:, k) / xmax(k);
z(:, k) = phase(:, k) - phase(ind(k), k);
end
phase = z;
end
Valora esta pregunta


0