I'm not sure how regress work we were asked to generate regress function using
this >> Xliner = [X; ones(1,sampleData);];
but I don't know what does X represent in sampleData = 100;x = linspace(-5,5);y= 1.6 * x .^2 + 2.5*x+6; dataset = randn(2,sampleData); figure p = polyfit(x,dataset(1,:)+y,1); r = p(1) .* x + p(2); plot(x,dataset(1,:)+y,'ob','MarkerFaceColor','b') hold onplot(x,dataset(1,:)+y) hold offlegend('raw data')xlim([-4 6])
Best Answer