Advice on formulating a minimization function
显示 更早的评论
I am modeling ballistic data using the Low-Angle Trajectory approximation of quadratic drag from
R. D. H. Warburton and J. Wang, “Analysis of asymptotic projectile motion with air resistance using the Lambert W function,” American Journal of Physics, Vol. 72,pp. 1404–1407, 2004.
the revelant functional forms of (5) and (6) are
vxFcn = @(v0,th,b,t) v0*cos(th)./(1+v0*cos(th)*b.*t);
vyFcn = @(v0,th,b,t) ((v0*sin(th)-0.5*g.*t)./(1+v0*cos(th)*b.*t)) - 0.5*g.*t;
xFcn = @(v0,th,b,t) (1/b) * log(1 + v0*b*cos(th)*t);
yFcn = @(v0,th,b,t) (v0*sin(th) + (g/(2*b*v0*cos(th)))).*(1/(b*v0*cos(th))).*log(1+b*v0*cos(th).*t)-(0.25*g.*t.^2);
The measurements of vx and vy are noisy, while the measured impact locations, ximpact and yimpact are precise.
I use fmincon twice, the first pass uses velocityMinFcn below, with
k = [v0,th,b]. Here t is the vector of measurement times
function SSE = velocityMinFcn(k)
vxm = vxFcn(k(1),k(2),k(3),t);
vym = vyFcn(k(1),k(2),k(3),t);
SSE = sum((vxm-vx).^2) + sum((vym-vy).^2);
end
I then do a refinment pass, again using fmincon, with k = [v0,th,b,impactTime] using v0, th and b from the first pass
function SSE = impactLocationFcn(k)
SSE = abs(xFcn(k(1),k(2),k(3),k(4)) - ximpact);
SSE = SSE + abs(yFcn(k(1),k(2),k(3),k(4)) - yimpact);
end
My question is I would like to combine the two minimization function into one and am looking for advice on how best to do it
2 个评论
William Rose
2024-2-1
编辑:William Rose
2024-2-1
Please provide some example data, and the script you are using thus far, if you have one.
Am I right to understand that you are trying to esitmate v0, theta, and b (drag coiefficient) that is consistent with the measured data?
Am I right to understand that you have measured data:
- vectors x, y, vx, vy, t
- scalars ximpact, yimpact, timpact
Are the functions vxFcn, vyFcn, xFcn, yFcn supposed to return vectors when called with vector time, and scalar when called with scalar time?
When you call impactLocationFcn, do you pass a scalar time for k(4)?
Your function SSE=impactLocationFcn refers to ximpact and to yimpacty. yimpacty looks like a spelling error which could cause an error.
Collin Pecora
2024-2-1
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Genomics and Next Generation Sequencing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


