TransWikia.com

Help with FindFit for NIntegrate

Mathematica Asked by Jun on January 24, 2021

I am trying to fit my data with below function to obtain certain parameter.
enter image description here,where enter image description here and enter image description here. R is dependent variable and b is independent variable. td is a parameter I need to fit.

I wrote my code at below.

data = {{0, 402.23*2*Pi/550}, {5*Pi/180, 369.77*2*Pi/550}, {10*Pi/180,
 346.32*2*Pi/550}, {15*Pi/180, 312.58*2*Pi/550}, {20*Pi/180, 
287.52*2*Pi/550}, {25*Pi/180, 270.27*2*Pi/550}, {30*Pi/180, 
240.56*2*Pi/550}, {35*Pi/180, 224.80*2*Pi/550}, {40*Pi/180, 
203.62*2*Pi/550}, {45*Pi/180, 186.31*2*Pi/550};

n0 = 1.5224;
l = 550;
d = 4400;
k =1.51389;
v = 0.233947;

mode1[t] := Sqrt[1 + k*Sin[t]^2];
mode2[a_, t_, b_] := ((Cos[a]*Sin[b]/(n0*Sin[a])) - 
 Cos[ArcSin[Sin[b]/n0]])*Sqrt[1 + k*Sin[t]^2];
rtd[a_?NumericQ, td_?NumericQ, b_?NumericQ]:= NIntegrate[[2*Pi*n0*d*mode2[a, t, b], {t,0,td}]/((l)*(NIntegrate[mode1[t], {t,0,td}]));

nlm=FindFit[data,rtd[a,td,b],{a,td},b]

When I fitted with this code, I had estimated the value of td to be smaller than Pi/2. However, I obtainedenter image description here.
Furthermore, I could not obtain adequate fitting curve.

Show[ListPlot[data],Plot[rtd[a, td, b] /. nlm, {b, 0, 45*Pi/180}]]

enter image description here

I am new to Mathematica, so I am not used to use it.
Can you please correct my code?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP