나는 다음과 같은 두 개의 파일이 개 간단한 기능을 가지고 :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' 않습니다, 당신이 그것을 호출 할 때
tobs
을 위해 그것을 값을 전달해야합니까? – hbaderts@hbaderts 그것은 몇 가지 간격과 관절 기능의 Riemann 근사치 인 thetavals와 postvals를 반환합니다. – noclew
오류 메시지에 따르면 충분한 입력 인수가 없습니다. 'opt_compute_posterior (plJoint (you_need_an_input_here), 0, 300, 1000)'이 필요합니다. –