爲什麼我的代碼不計算變量cos_theta
,然後theta
?MATLAB:爲什麼我沒有得到任何輸出?
代碼:
alpha = alpha_min:alpha_step:alpha_max;
cos_theta_0 = -1./(2.*alpha)+sqrt(1.+1./(4.*alpha.^2));
theta_0 = acos(cos_theta_0);
hmax = (sqrt(1+4.*alpha.^2)-1)./(2.*log(2));
for h = 1:(K-2);
if h<= hmax;
cos_theta(h,:) = cos_theta_0- h.*log(2)./alpha;
theta(h,:) = acos(cos_theta(h,:));
else break;
end
end
尋求調試幫助的問題(「爲什麼這個代碼不工作?」)必須包含所需的行爲,特定的問題或錯誤以及在問題本身中重現問題所需的最短代碼。沒有明確問題陳述的問題對其他讀者無益。 – dasdingonesin
另請參見:[MCVE](http://stackoverflow.com/help/mcve) – dasdingonesin
@dasdingonesin對不起,我對Matlab沒有信心,而且我正試圖儘可能快地改進它。 – ElenaPhys