19.4k views
2 votes
The file car_speed.mat(available on Canvas under HW4) contains the results of such a test, in the form of a time vector t (in seconds) and a speed vector v (in miles per hour).1) Write a completely genericMATLAB function that implements the quadratic polynomialregression technique. The function should have the formfunction [a,Syx,r]

1 Answer

3 votes

Answer:

function [c err r] = regressor(t, v, degree)

mx = v ;

my = t ;

c = fliplr((pinv(mx' * mx) * mx' * my)');

r = corrcoef(v,t)

V1 = arrayfun(@(x)(polyval(R,x)), W);

error = my - V1

err = norm(error)

end

Step-by-step explanation:

User Pro
by
4.2k points