How to solve problem with function lscuvfit, whena i have ther integral without xmax? Thank you.

1 view (last 30 days)
How to solve this proble please?
y= [0.871 0.928 0.946 0.952 0.958 0.965 0.971 0.979 0.987 0.992 0.995 0.997];
x=[0.2 0.5 0.7 0.8 0.9 1.1 1.5 2.3 4.6 9.2 22.9 45.9];
x0=[5 0.03];
fun=@(par,y)integral(((2-par(1))./(1-par(1)))^(5/2),0,y);
sol= lsqcurvefit(fun,x0,x,y);
The right solution of par (1) and y must be a 0.965.

Answers (1)

Matt J
Matt J on 10 Apr 2021
Edited: Matt J on 10 Apr 2021
The right solution of par (1) and y must be a 0.965.
Why do you speak of y as if it is an unknown? The unknown parameters are supposed to be the vector elements par(i). Also. your model fun(par,y) doesn't look right for several reasons,
  • The integrand passed to integral() is not a function handle
  • You have 2 unknowns in x0, but only 1 unknown in par
  • You've written it in terms of par and y instead of par and x
Also note that if the integrand is intended to be a par-dependent constant, you can do the integral analytically. You don't need the integral() coommand.
  1 Comment
Lenny Guitar
Lenny Guitar on 11 Apr 2021
Thank you for you answer.I try to correct this expression, but still without working this. I spent lot of time on this problem, but i dont know, how solve this. Thank you again for your help.

Sign in to comment.

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!