Numerical Integration with limits-dependent parameters

1 次查看(过去 30 天)
Hi,
I'm looking at integrating numerically a function which has two parameters dependent of the integral limits such as e.g.:
integral from x=-1 to x=1 of f(x)=a^2*(c1*b^2 - c2*b + c3)
where a and b are parameters specified at x=-1 and x=1. And c1, c2, c3 are constants.
So far I've tried to do it like this but struggling to define the parameters
fun = @(x) a^2*(c1 * b^2 - c2 * b + c3);
q = integral(fun,-1,1);
Thanks for the help.
  6 个评论
Torsten
Torsten 2017-11-9
You said the coefficients depend on the integral limits, now they depend on the integration variable.
And the construction
a = @(x) x*(a(xmax) - a(xmin)) + (xmax - xmin);
b = @(x) x*(b(xmax) - b(xmin)) + (xmax - xmin);
where a and b call themselves inside the function handle looks very strange to me.
Best wishes
Torsten.
etienne
etienne 2017-11-9
Sorry if that was not clear. Basically I have a value of 'a' and 'b' at 'xmin' and 'xmax' [a(xmin),a(xmax),b(xmin),b(xmax)]. What I did earlier was to define 'a' and 'b' as functions of 'x'. Not sure that's correct though.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by