Estimating two coefficients out of three in quadratic function
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi Everybody, I need to estimate coefficients of this equation aN^2 + bN. It is standard quadratic function but coefficient c=0. My data is a time series, where:
x= [ 0, 5 ,9, 10,15, 16]
y= [715,901, 1139, 1224,1553,1712]
F=polyfit(x,y,3)
plot(F)
As you can see I am using polyfit, which gives me 3 coefficients: a=1.9029 b=30.1841 c=712.7646. I need c to be 0. Do you know any way to calculate only a and b, setting c as 0? I will much appreciate your help, as i am stuck a bit. Thank you :)
댓글 수: 0
채택된 답변
Star Strider
2017년 11월 19일
Try this:
x= [ 0, 5 ,9, 10,15, 16];
y= [715,901, 1139, 1224,1553,1712];
F = [x(:).^2 x(:)]\y(:);
eqnstr = sprintf('F(x) = %.2f\\cdotx^2 + %.2f\\cdotx', F)
xv = linspace(min(x), max(x));
figure(1)
plot(x, y, 'pg')
hold on
plot(xv, polyval([F(:)' 0],xv), '-r')
hold off
grid
text(3, 1300, eqnstr)
댓글 수: 10
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Probability Distributions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!