how to right matlab code

1 view (last 30 days)
devendra
devendra on 12 Mar 2015
Edited: devendra on 23 Mar 2015
clear all; close all;
%%%%%%%ensemble_avg calculating form this method. ensemble_avg = o;
for i = 1:5
if i == 1;
load model_1_data.mat;
ensemble = model_1;
elseif i == 2;
load model_2_data.mat;
ensemble = model_2;
elseif i == 3;
load model_3_data.mat;
ensemble = model_3;
elseif i == 4;
load model_4_data.mat;
ensemble = model_4;
elseif i == 5;
load model_5_data.mat;
ensemble = model_5;
end
ensemble_avg = ensemble_avg + ensemble;
ensemble_avg = ensemble_avg/5;
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
natural_variability = 0.4595;
m_r_b = 0;
m_r = 0;
m = 1 ; n = 1; % for this calculation taking m = 1 and n = 1
for i = 1:5
if i == 1;
load observation.mat;
load model_1_data.mat;
bias = model_1 - obs;
elseif i == 2;
load model_2_data.mat;
bias = model_2 - obs;
elseif i == 3;
load model_3_data.mat;
bias = model_3 - obs;
elseif i == 4;
load model_4_data.mat;
bias = model_4 - obs;
elseif i == 5;
load model_5_data.mat;
bias = model_5 - obs;
end
distance = bias - ensemble_avg;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
model_reli = (((natural_variability/abs(bias)).^m).*((natural_variability/abs(distance)).^n));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
m_r_b = m_e_e + (model_reli.*bias); % model reliability and model bias
m_r = m_e + model_reli;
weigh_avg_ens = m_e_e/m_e; % rea method (average change)
end
this is code for this attached file . this right or wrong and pls help me how will be repeat procedure for equation 3rd and 4th
  3 Comments
Sara Hafeez
Sara Hafeez on 12 Mar 2015
They are basic summation and division equations with a power or exponent of n you can easily do them if you know basic maths
devendra
devendra on 12 Mar 2015
i have already written code for these equation but i want to crosscheck that my code is right or wrong but thank you so much for your nice comment. this time i am at home i will also attached my code tomorrow when i will in lab.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!