Curve fitting of transcendental equation with lsqcurvefit

3 views (last 30 days)
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:
  1. Assumin both as a xdata (vector).
  2. 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.

Accepted Answer

Torsten
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)

More Answers (0)

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!