필터 지우기
필터 지우기

WHAT'S THE WRONG IN MY CODE?

조회 수: 2 (최근 30일)
mary pean
mary pean 2012년 11월 16일
function [MLE] = RiskMetrics(data)
sigma2 = zeros(length(data),1);
sigma2(1) = mean(data.^2);
for i = 2 : length(data)
sigma2(i) = (0.06*data(i-1).^2) + (0.94*sigma2(i-1));
end
f = -0.5*log(2*pi*sigma2)-(data.^2)/(2*sigma2);
MLE = sum(f);
end
And MATLAB WINDOW shows me that message: Error using - Matrix dimensions must agree.
Error in RiskMetrics (line 7) f = -0.5*log(2*pi*sigma2)-(data.^2)/(2*sigma2);
I've also tried the 'minus' but nothing...

채택된 답변

Matt J
Matt J 2012년 11월 16일
Looks like you need ./ here
(data.^2)./(2*sigma2)
  댓글 수: 1
mary pean
mary pean 2012년 11월 16일
yap!!!! thank you so much!!!!!!!!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Time Series Events에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by