how to right matlab code

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 Commenti

Robert Alvarez
Robert Alvarez il 12 Mar 2015
Have you tried to write the code? Does your attempt work? Do that and insert it into your question and we can comment.
If you do not know how to start, I suggest you read tutorials or a book on Matlab. There are many of them,
Sara Hafeez
Sara Hafeez il 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 il 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.

Accedi per commentare.

Risposte (0)

Categorie

Richiesto:

il 12 Mar 2015

Modificato:

il 23 Mar 2015

Community Treasure Hunt

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

Start Hunting!

Translated by