Why does trapz yield infinity
9 views (last 30 days)
Show older comments
Hi there...
Why does the following code yield infinity
x = 0:0.001:1;
ytDiff = 1./(2*(x).^(1/2));
ArcEq = sqrt(1+ytDiff.^2);
s = trapz(x,ArcEq)
when the actual value should be s = 1.4789!?
Thanks!
0 Comments
Accepted Answer
the cyclist
on 25 Apr 2014
Edited: the cyclist
on 25 Apr 2014
Because that function approaches infinity at x=0, and you have included that endpoint of the interval explicitly. Try this instead:
x = 0.001:0.001:1;
ytDiff = 1./(2*(x).^(1/2));
ArcEq = sqrt(1+ytDiff.^2);
s = trapz(x,ArcEq)
0 Comments
More Answers (1)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!