인덱스 배열 초과 관련해서 코드 질문입니다. 왜 이런 문제가 생기나요(데이터 첨부)
Ältere Kommentare anzeigen
% 엑셀 파일 경로 및 시트 이름 설정
file_path = 'KOFR_보완.xlsx';
sheet_name = 'Sheet1';
% 엑셀 파일에서 데이터 가져오기
excel_data = xlsread(file_path, sheet_name);
% 날짜와 KOFR 열 선택
dates = excel_data(:, 1);
kofr_column = excel_data(:, 2);
% ADF 단위근 검정 수행
[h, pValue, stat, cValue, reg] = adftest(kofr_column, 'lags', 0);
% 결과 출력
fprintf('ADF 단위근 검정 결과:\n');
fprintf('검정 통계량 (ADF 통계량): %.4f\n', stat);
fprintf('P-값: %.4f\n', pValue);
fprintf('임계값 (1%%, 5%%, 10%%): %.4f, %.4f, %.4f\n', cValue(1), cValue(2), cValue(3));
% 검정 결과 해석
if h == 0
fprintf('결론: 귀무가설을 기각할 수 없으므로 시계열에는 단위근이 존재합니다.\n');
else
fprintf('결론: 귀무가설을 기각하므로 시계열에는 단위근이 존재하지 않습니다.\n');
end
위치 2의 인덱스가 배열 경계를 초과합니다. 인덱스는 1을(를) 초과해서는 안 됩니다.
1개의 열로 되어있는 변수 KOFR데이터를 가져와서 코드를 돌리는데 자꾸 아래와 같은 오류가 뜹니다...
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu 데이터 가져오기와 분석 finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!