Hi everybody, I have a very simple theoric problem but I don't know how to resolve it.
I just wanna do a curve fitting like this:
I want the red line to fit the red dashed one as much as possible in the [0.3 – 0.6] interval.
The red line is a 100×1 vector (x-axis) and 100×1 vector (y-axis).
The red dashed curve is given by this equation (much longer, cropped here):
function [ d2 ] = d2_current( alpha,beta,phi,N,V )d2 = (4903985730770845.*N.*(((exp(alpha.*(phi - V.*(beta - 1))) + 1).*((alpha.^2.*beta.^2.*exp(alpha.*... end
Where V is the dependent variable, the previous 100×1 vector (x-axis) corresponding to the [0.3 – 0.6] interval.
The equation depends on 4 independent parameters, each one of them may be included in these intervals:
beta; from to a 1alpha; from 0 to 15N; from 0 to 300phi; from 0 to 3
I have to vary these parameters in order to obtain the best fitting, note that the parameters value must be the same for one single fitting.
The first thing I did was 4 different 'for' loops for each parameter and try to compare each single result with the red curve my means of the euclidean distance. (simplified code):
cont = 0; for beta = 0:0.01:1 for alpha = 0:0.01:15 for N = 0:1:300 for phi = 0:0.01:3 distance_euclidean(cont,1) = norm(current_red_curve - current_red_dashed_curve); cont = cont + 1; end end end end minim_eucl = min(distance_euclidean);
The minimum euclidean distance would be the best fitting. For the graph example:
beta = 1;alpha = 15;N = 300;phi = 0.45;
Everything is fine until this point, but there's a big problem: the computing time is just huge when the step in the 4 intervals decreases (needed because of the poor fitting).
Looking for better solutions I found the possible way to go: the genetic algorithm. I've been trying it on the Matlab optimization tool, but with no results.
Could somebody help me out?
Thank you very much for your help.
Regards,
Best Answer