我有兩個單獨的文件兩個簡單的功能,象下面這樣:MATLAB:「沒有足夠的輸入參數」錯誤
function [thetavals postvals] = opt_compute_posterior(joint, theta_min, theta_max, num_steps)
thetavals = linspace(theta_min, theta_max, num_steps);
postvals = joint(thetavals);
postvals = postvals/(sum(postvals) .* ((theta_max - theta_min)/num_steps));
end
function joint = plJoint(tobs)
gamma = 2.43;
joint = @(theta)((1 ./ (theta.^(gamma + 1))) .* (tobs < theta));
end
當我與 opt_compute_posterior(plJoint, 0, 300, 1000)
測試此代碼,我有一個「沒有足夠的輸入參數錯誤。 「,而且我找不到代碼出錯的地方。請點亮我的燈。
是什麼'這opt_compute_posterior'返回? – hbaderts
@hbaderts它返回thetavals和postvals,這是一些間隔和聯合函數的Riemann近似 – noclew
根據錯誤消息,您沒有足夠的輸入參數。你需要'opt_compute_posterior(plJoint(you_need_an_input_here),0,300,1000)''。 –