Curve fitting using custom equation
Show older comments
I got a costum equation in the form of
OPCrtr = @(r) 1.5186e-08.*integral(5.9122e-6.*A.*exp(-5e-7.*a.^2).*(1-exp(-alpha.*10.*a.^2))./(4.*alpha.*a.^2).*besselj(0,r.*a).*a, 0,Inf);
and the experimental data of
y = [5.63519982407452, 4.38965221332586, 3.08480267517907, 2.53580063087177, 1.84559777892743, 1.23011321773770, 0.662503695933817, 0.300962951613869];
r = [0.861841642228739, 1.50647116324536, 2.08103225806452, 2.65559335288368, 3.25818181818182, 3.90281133919844, 4.61750928641251, 5.61248093841642];
with the boundary conditions of min(r) = 0, max(r) = 14e-6.*512, and the initial conditions of A = 0.129, alpha = 5.17e-7.
When I was trying to fit using the Curve ftting toolbox, it returns "The expression is not a valid MATLAB expression, has non-scalar coefficients, or cannot be evaluated:".
How can I fit the data using the above custom equation please?

7 Comments
Torsten
on 27 Apr 2023
So you want to fit A and alpha and your vector y should be modelled as y(r) = OPCrtr(r) ? Why is min(r) = 0, max(r) = 14e-6.*512 while your r-vector doesn't satisfy these constraints ?
Jingtao
on 27 Apr 2023
Torsten
on 27 Apr 2023
But the range for r of the theoretical model equation and of your data points should be identical. Otherwise, the model equation could not be used for your data.
Jingtao
on 27 Apr 2023
Torsten
on 28 Apr 2023
You have experimental data for a range of r between 0.8 and 5.6. So you can fit coefficients A and alpha for the model function for a range of r between 0.8 and 5.6. It doesn't make sense trying to evaluate the model function in the range 0 <= r <= 14e-6 * 512 because you didn't have experimental data for this range.
Jingtao
on 28 Apr 2023
Torsten
on 28 Apr 2023
Make sense. So how can I do it?
By getting experimental data for the range of interest (0 <= r <= 14e-6.*512).
Accepted Answer
More Answers (0)
Categories
Find more on Annotations 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!
