Can lqscurvefit() be used with mutiple independent X values?

3 vues (au cours des 30 derniers jours)
Shashank Rajput
Shashank Rajput le 3 Déc 2021
Commenté : Star Strider le 4 Déc 2021
I was trying to fit the model with multiple independent x values to find multiple parameters value. However, I could not fit the data myself with multiple independent X values. I was using the following code:
% Reading the dataframe
Follower=readtable('Follower.csv');
Leader = readtable('leader.csv');
Approx_fol=readtable('Approx_Fol');
Approx_lead=readtable('Approx_lead');
%finding the follower position
fol_pos = 482.768453-Approx_fol.fol_Smooth_Y;
% finding the leader position
pos_lead = 482.768453-Approx_lead.lead_Smooth_Y;
veh_len = 4.572;
%finding the gap
s = (pos_lead- fol_pos -veh_len)
Fol_v = Approx_fol.fol_Smooth_approx_v_vel;
lead_v = Approx_lead.lead_Smooth_approx_v_vel;
obj = zeros(521,1);
IDM_acc = zeros(521,1);
Velocity = zeros(521,1);
Position = zeros(521,1);
S_sim = zeros(521,1);
%Intial value of the parameters x0=[vo,T,so,a,b,delta]
%x0 = [15.8,1.41,3.4,2.35,1.9,4];
x0 = [20,1,3,2,2,4];
counter=1;
vo=x0(1);
T=x0(2);
so=x0(3);
a=x0(4);
b=x0(5);
delta=x0(6);
[S_sim] = IDM_Model(S_sim,x0(1),x0(2),x0(3),x0(4),x0(5),x0(6),obj,IDM_acc,Velocity,Position,Fol_v,fol_pos,lead_v,pos_lead,veh_len)
options = optimoptions('lsqcurvefit','Algorithm','levenberg-marquardt');
x = lsqcurvefit(IDM_Model,x0,obj,IDM_acc,Velocity,Position,Fol_v,fol_pos,lead_v,pos_lead,veh_len,s);
Here i m trying to find the parameter value of x0 using the levenberg-marquardt algorithm and trying to minimize the objective function (S_sim - s)^2 .
Any help in this regard would be appreaciated. Thanks in advance.
  3 commentaires
Shashank Rajput
Shashank Rajput le 4 Déc 2021
Thanks, it worked fine!!!
Star Strider
Star Strider le 4 Déc 2021
My pleasure!
.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Geometric Transformation and Image Registration dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by