Hi, anybody can help me to check for question b whether my answer is correct or not? Thanks.

Answers (2)

My demo on polyfit is attached. It fits a line and a cubic. Adapt as needed for your problem.
For example:
coefficients = polyfit(t, y, 2);
fprintf('The equation is y = %f*t^2 + %f*t + %f\n',...
coefficients(1), coefficients(2), coefficients(3));
yfitted = polyval(coefficients, t);
sumOfResiduals = sum(............. you finish it.

Categories

Find more on Mathematics and Optimization in Help Center and File Exchange

Asked:

on 12 Jul 2015

Answered:

on 12 Jul 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!