Integration in m file
Show older comments
Really struggling with how integration works in matlab, I want to calculate the area under the function x+3 with limits 0 and where x+3 meets tan(x).
I have this but cannot get it to run.
thanks for any help
uplim = fzero(@(x) tan(x)-x-3,1.2)
function y=integrand(x);
y=(x+3);
I1=quad('integrand',0,uplim)
Answers (1)
Roger Stafford
on 3 Sep 2013
0 votes
Yes, I think you did misinterpret it. The question asks for the area "confined by the functions f(x)=x+3 and g(x)=tan(x)", not the area under f(x). You need f(x)-g(x) as an integrand. Make a plot of both functions and you'll see the difference.
1 Comment
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!