to find area of parabola?
2 views (last 30 days)
Show older comments
parabola going from three point (7.8 0.96), (8.25 0.99), (8.55 0.94), how can I compute area under the parabola?
x=[7.8 8.25 8.55];
y=[0.96 0.99 0.94];
p=polyfit(x,y,2);
f=polyval(x,p);
plot('x','y','o','x','f','-');
0 Comments
Accepted Answer
bym
on 6 Apr 2013
x=[7.8 8.25 8.55];
y=[0.96 0.99 0.94];
p=polyfit(x,y,2);
%f=polyval(x,p); x & p should be reversed
%plot('x','y','o','x','f','-'); read plot documentation
% method 1
t = linspace(x(1),x(3));
yhat = polyval(p,t);
a1 = trapz(t,yhat);
% method 2
f = @(v) p(1)*v.^2+p(2)*v+p(3);
a2 = quadgk(f,x(1),x(3));
a1,a2
a1 =
0.7344
a2 =
0.7344
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!