Curve fitting of transcendental equation with lsqcurvefit
3 views (last 30 days)
Show older comments
I have a transcendental equation of the form
ω is ydata
μ is xdata
x(1) = A1 (unknown to find through curve fit)
x(2)= A5 (unknown to find through curve fit)
Every other parameters are constants.
Stratergy:
- Assumin both as a xdata (vector).
- ydata will be zeros of vector.
predictedzeros = @(x,xdata)-xdata(2)-sqrt(k_val)/sqrt(m_canti_val+x(2)*B_val*Gap_val*L_val*GWM_density(1)+sqrt(2*xdata(1)*GWM_density(1)/xdata(2))*x(1)*B_val*L_val);%x1,x2 are unknown.
x0 = [1;1.2]; %initial guess
Xdata=GWM_viscosity'; Ydata=GWM_f_out';
zeroes = zeros(1,length(Xdata))';
x = lsqcurvefit(predictedzeros ,x0,[Xdata;Ydata],zeroes)
I am getting the error as given below.
Error using lsqcurvefit
Function value and YDATA sizes are not
equal.
Please let me guide to do the curve fitting of transcendental equation either though this method or any other method.
Thanks.
0 Comments
Accepted Answer
Torsten
on 8 Jun 2022
Xdata=GWM_viscosity';
Ydata=GWM_f_out';
predictedzeros = @(x) Ydata + sqrt(k_val)./sqrt(m_canti_val+x(2)*B_val*Gap_val*L_val*GWM_density(1)+sqrt(2)*x(1)*B_val*L_val.*sqrt(GWM_density(1)*Xdata./Ydata)) ;
x0 = [1;1.2]; %initial guess
x = lsqnonlin(predictedzeros,x0)
0 Comments
More Answers (0)
See Also
Categories
Find more on Interpolation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!