Store as array not variable
显示 更早的评论
I have the following function:
function f = function42(params2,T0,theta_f)
% f = x^2 %f and x are dummy variables
global a b
nu = params2(1);
phi = params2(2);
wf2 = params2(3);
c1 = b^2*(((exp(a*2*pi)-cosh(a*b*T0))/sinh(a*b*T0))^2-1);
Fitted_Curve = c1*exp(-2*a*theta_f)+nu*((1+0.5*(4*a^2+1))*cos(theta_f+phi)-2*a*sin(theta_f+phi))+b^2-wf2
f = sum(abs(Fitted_Curve));
T0 and theta_f are 1x9 vectors Fitted_Curve comes out in the workspace as a 1x9 vecot also, however c1 does not, it comes out as a variable and therefore i dont think it is using the corresponding T0 with theta_f for each calculation. My question is how do i get c1 to be a vector so that the corresponding c1 is used with the corresponding theta_f in the equation Fitted_curve.
Side note.
anyone know if i am doing the least squares method correctly here in this function.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!