我有两个单独的文件两个简单的功能,象下面这样: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)''。 –