MatLab - Can't understand error
MatLab:
??? Error using ==> mtimes
Inner matrix dimensions must agree.
Error in ==> test at 12
f = x(3) + x(2) * y + x(1) * y * y;
I'mtrying to plot a polynom I just made, or trying to make. And I can understand which matrix size that's messing things up.
Code:
t = [0 0.5 1.0 1.5 2.0]';
c = [0 0.19 0.26 0.29 0.31]';
A = [t.*t, t, ones(length(t),1)];
%Normal equations:
order = 2;
x = zeros((order+1),1);
x = A\c;
y = 0:0.1:2;
f = zeros(length(y),1);
f = x(3) + x(2) * y + x(1) * y * y;
plot(f,y);
I'm quite new to MatLab, so bear with me... (Nerd)