Skip to content

Commit 33d5cde

Browse files
authored
Update EnKF.m
Revert a change
1 parent 6d54b51 commit 33d5cde

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

plugins/Kalman/m/EnKF.m

+8-14
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,27 @@
1-
function [z_inverse] = EnKF(m, A, P, Q, L, R, timeSteps, number_of_frames, n_ensembles, q_given)
1+
function [z_inverse] = EnKF(m, A, P, Q, L, R, timeSteps, number_of_frames, n_ensembles)
22
%ENKF Summary of this function goes here
33
%x_ensemble = mvnrnd(zeros(size(m)), 100* ones(size(m,1)), n_ensembles)';
44
x_ensemble = mvnrnd(zeros(size(m)), P, n_ensembles)';
55
z_inverse = cell(0);
6-
if not(q_given)
7-
q_values = Q;
8-
end
9-
h = zef_waitbar(0, 'EnKF Filtering');
6+
h = zef_waitbar(0,1, 'EnKF Filtering');
107
for f_ind = 1:number_of_frames
11-
zef_waitbar(f_ind/number_of_frames,h,...
8+
zef_waitbar(f_ind,number_of_frames,h,...
129
['EnKF Filtering ' int2str(f_ind) ' of ' int2str(number_of_frames) '.']);
1310
f = timeSteps{f_ind};
14-
if not(q_given)
15-
Q = diag(q_values(:,f_ind));
16-
end
1711
w = mvnrnd(zeros(size(m)), Q, n_ensembles)';
1812
% Forecasts
1913

2014
x_f = A * x_ensemble + w;
2115
C = cov(x_f');
2216
correlationLocalization = true;
2317
if correlationLocalization
24-
T = corrcoef(x_f');
25-
% explain How to find 0.05
26-
T(abs(T) < 0.05) = 0;
27-
C = C .* T;
18+
T = corrcoef(x_f');
19+
% explain How to find 0.05
20+
T(abs(T) < 0.05) = 0;
21+
C = C .* T;
2822
end
2923
v = mvnrnd(zeros(size(R,1),1), R, n_ensembles);
30-
24+
3125
% method to calculate resolution D
3226
method = '3';
3327
if(method == '1')

0 commit comments

Comments
 (0)