양의 부동 소수점 값인 200 개의 샘플 데이터를 포함하는 벡터 'measured_data'세트가 있습니다. 이 데이터에 맞는 모델을 찾기가 힘듭니다. 다음 코드는 모든 단계에서 오류를 반환합니다. 예를 들어 predict()를 주석하면 다음 명령에서 다른 오류가 발생합니다. 아무 것도 작동하지 않는 것 같습니다. 철저하게갔습니다. 문서를 통해 문제가 무엇인지 그리고 내가 잘못 될지 이해할 수없는 것 같습니다. 누군가 코드를 읽고 문제를 완화하는 데 도움이된다면 정말 감사 할 것입니다. 감사합니다.커브 피팅 및 기타 구문 문제로 인한 오류
Undefined function 'predict' for input
arguments of type 'double'.
Error in Untitled (line 157)
model2_pred = predict(model2_coeff, model2_data, 1);
CODE
model1 = ar(measured_data, 2,'yw');
model2 = ar(measured_data, 5,'yw');
coeffs1 = model1.a;
model1_coeff=[coeffs1(2) coeffs1(3)]
coeffs2 = model2.a;
model2_coeff=[coeffs2(2) coeffs2(3) coeffs2(4) coeffs2(5)]
x(1) = 0.0;
x(2) = 0.0;
y(1) = 0.0;
y(2) = 0.0;
y(3) = 0.0;
y(4) = 0.0;
%Solve for Model1 by putting in the coefficient values
for i=3:200
x(i) = coeff1(2) *x(i-1) +coeff2(3)*x(i-2) ;
end
model1_data=x;
%Solve for Model2 by putting in the coefficient values
for i=5:200
y(i) = coeff2(2) *y(i-1) +coeff2(3)*y(i-2) +coeff2(4)*y(i-3) +coeff2(5)*y(i-4) ;
end
model2_data=y;
model1_pred = predict(model1_coeff, model1_data, 1);
model1_residual=model1_data-model1_pred;
model1_err = resid(model1_coeff,measured_data); %prediction errors
model2_err = resid(model2_coeff,measured_data);
subplot(1,2,1);
plot(model1_err);
subplot(1,2,2);
plot(model2_err);
model1_mse=sqrt(mean((measured_data-model1_coeff).^2)); %Mean square error
model2_mse=sqrt(mean((measured_data-model2_coeff).^2));
compare(measured_data,model1_coeff,'g',model2_coeff,'b');
즉, MATLAB은'predict' 함수를 찾을 수 없습니다. 시스템 식별 도구 상자가 설치되어 있지 않은 것처럼 나에게 들립니다. – wakjah
도구 상자가 있습니다. – user1142671