to find area of parabola?
조회 수: 2 (최근 30일)
이전 댓글 표시
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
채택된 답변
bym
2013년 4월 6일
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
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!