|
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) |
2 | 2 | %ENKF Summary of this function goes here
|
3 | 3 | %x_ensemble = mvnrnd(zeros(size(m)), 100* ones(size(m,1)), n_ensembles)';
|
4 | 4 | x_ensemble = mvnrnd(zeros(size(m)), P, n_ensembles)';
|
5 | 5 | 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'); |
10 | 7 | 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,... |
12 | 9 | ['EnKF Filtering ' int2str(f_ind) ' of ' int2str(number_of_frames) '.']);
|
13 | 10 | f = timeSteps{f_ind};
|
14 |
| - if not(q_given) |
15 |
| - Q = diag(q_values(:,f_ind)); |
16 |
| - end |
17 | 11 | w = mvnrnd(zeros(size(m)), Q, n_ensembles)';
|
18 | 12 | % Forecasts
|
19 | 13 |
|
20 | 14 | x_f = A * x_ensemble + w;
|
21 | 15 | C = cov(x_f');
|
22 | 16 | correlationLocalization = true;
|
23 | 17 | 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; |
28 | 22 | end
|
29 | 23 | v = mvnrnd(zeros(size(R,1),1), R, n_ensembles);
|
30 |
| - |
| 24 | + |
31 | 25 | % method to calculate resolution D
|
32 | 26 | method = '3';
|
33 | 27 | if(method == '1')
|
|
0 commit comments