How to get best fitting Parameters for a function for all datapoints
Afficher commentaires plus anciens
syms lh lo r
U_in = 10;
w = 2*pi*[111452 131857 142436 157777 195689 230000 260000 347213 400000];
u_ll = [9.015 9.25 9.37 9.53 9.765 10 10 10 10];
b1_ll = w(1) * (lh +lo);
b2_ll = w(2) * (lh +lo);
b3_ll = w(3) * (lh +lo);
eqn1 = (u_ll(1) == abs((r+1i*b1_ll)*U_in/(50+r+1i*b1_ll)));
eqn2 = (u_ll(2) == abs((r+1i*b2_ll)*U_in/(50+r+1i*b2_ll)));
eqn3 = (u_ll(3) == abs((r+1i*b3_ll)*U_in/(50+r+1i*b3_ll)));
eqns = [eqn1, eqn2, eqn3];
[s_lh, s_lo, s_r] = solve(eqns,[lh lo r]);
Réponses (1)
You cannot estimate lh and lo separately in your approximating model, only their sum (lh+lo).
But your model seems to return constant values - independent of your fitting parameters.
U_in = 3;
w = 2*pi*[111452 131857 142436 157777 195689 230000 260000 347213 400000];
u_ll = [9.015 9.25 9.37 9.53 9.765 10 10 10 10];
fun = @(x) u_ll-abs((x(1)+1i*w*x(2))*U_in./(50+x(1)+1i*w*x(2)));
sol = lsqnonlin(fun,[2 -5])
r = sol(1)
lho = sol(2)
Catégories
En savoir plus sur Get Started with Curve Fitting Toolbox dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!