Curve fitting using custom equation
이전 댓글 표시
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
Torsten
2023년 4월 27일
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
2023년 4월 27일
Torsten
2023년 4월 27일
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
2023년 4월 27일
Torsten
2023년 4월 28일
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
2023년 4월 28일
Torsten
2023년 4월 28일
Make sense. So how can I do it?
By getting experimental data for the range of interest (0 <= r <= 14e-6.*512).
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

