trapuneq (unequal spaced trapezoidal rule quadrature)

2 次查看(过去 30 天)
Hi... I hope that I can solve a problem about trapenuq formula
x = [0 .12 .22 .32 .36 .4 .44 .54 .64 .7 .8];
y = 0.2+25*x-200*x.^2+675*x.^3-900*x.^4+400*x.^5;
trapuneq(x,y)
??? Undefined function or variable 'l'.
Error in ==> trapuneq at 18 s = s + (x(k+l)-x(k))*(y(k)+y(k+l))/2;
thanks

回答(1 个)

Sam
Sam 2023-4-14
Changing the 2 "l"s ("L"s; Capital shown for variable clarity) to a "1" ("One") in the line of the For loop fixes the error and allows the same anser to be attained as shown in the textbook (1.5948).

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by