Im trying to plot this function in matlab for theta from 0 to 3. Im completly new in matlab. I made 2 scripts.
First with symsum:
syms theta
u = [2,1,-1];
y = [3,2,1];
for theta = 0 : 0.1 : 2
Q(theta) = symsum((y(n) + u(n)*theta)^2,n,1,3);
end
plot(theta,Q(theta);
Error: Invalid indexing or function definition.
Second with symfun
for theta = 0 : 0.1 : 2
Q = symfun((3-2*theta)^2 + (2-theta)^2 + (1+theta)^2, [theta]);
end
plot(Q(theta), theta);
Error: y.vars = validateArgNames(inputs);