Here is the working code. However, I am NOT getting values that fit the data close to a good fit. Any suggestions?
theta = VarName1(:,1);
y = VarName2(:,1);
plot(theta,y,'bo')
xdata = VarName1;
ydata = VarName2;
lb = [-276.9; -1; -1; -1; -1];
ub = [-276.8; 1; 1; 1; 1];
predicted = @(c,xdata) c(1) + c(2)*cos(xdata) + c(3)*(cos(xdata)).^2 + c(4)*(cos(xdata)).^3 + c(5)*(cos(xdata)).^4;
c0 = [-276.838; -0.00656; 0.005231; 0.016035; 0.001128];
[c,resnorm,residual,exitflag,output,lambda,jacobian] = ...
lsqcurvefit(predicted,c0,xdata,ydata,lb,ub);
hold on
plot(xdata,predicted(c,xdata),'r-','markersize',20)
hold off