# Optimization of parameters for a calculated result having an experimental result

3 views (last 30 days)
Eduardo Chacin on 4 Sep 2018
Commented: Eduardo Chacin on 6 Sep 2018
Hello everyone, I have a function
Hc=par1.*(x.^par2).*(y.^par3).*(z.^par4).*exp(par5.*w).*exp(par6.*v)
I have the inputs x, y, z, w and v (they are number arrays of equal quantity of elements) and the initial values for par1, par2... par6, so I have multiple outputs of Hc. I also have the experimental values of H. I have the relative deviation for each one and the average relative deviation as follows:
RD=(H-Hc)./H.*100;
ARD=100*(sum(RD))/q; %where q is the number of elements
Now, I need to optimize those 6 parameters so that the relative deviation is as close to zero (0) as possible. How could I do that?

Alan Weiss on 4 Sep 2018
Perhaps along the lines of Curve Fitting via Optimization. Before fitting, you might want to take the logarithm of both sides of your equation in order to get a simpler expression to optimize.
Alan Weiss
MATLAB mathematical toolbox documentation
##### 2 CommentsShowHide 1 older comment
Eduardo Chacin on 6 Sep 2018
@Alan Weiss @Torsten I'm a beginner with MatLab and I'm having a really hard time with it. I'm gonna share what I've got and if someone could please explain me how to optimize (and if I need other files for example) I'd really appreciate it
function Hc = myfunction( P_k, T_k, c, z, w, v, IFexp )
y=T_k;
q=length(P_k);
%Initial values for parameters
par1=0.1442;
par2=2.6388;
par3=2.2083;
par4=0.2168;
par5=0.2;
par6=0.4;
%Ecuations
a=1.28+55.*(1./P_k+0.04).*exp(50.22./(T_k+230));
g=0.4+2084.69.*(1./P_k-0.002).*exp((-986.95)./(T_k+230));
x=(g./a).*c;
Hc=par1.*(x.^par2).*(y.^par3).*(z.^par4).*exp(par5.*w).*exp
(par6.*v);
disp(Hc)
RD=(IFexp-IFc)./IFexp.*100;
display(RD)
ARD=100*(sum(RD))/q;
display(ARD)
end
This far the program works, but I'm still stuck with the optimization.
I need that the average relative deviation (ARD) tends to 0.
How could I do that? Already having what I have