Index in position 1 exceeds array bounds. IRF plot.
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
I’m trying to plot the IRFs and when I insert
plot(x, exp(oo_.endo_simul(1,:)))
I get the error “index in position 1 exceeds array bounds”.
My x is defined as linspace(1,40,40);
Could you please help me with this?
채택된 답변
Cris LaPierre
2021년 3월 16일
The error has to do with the 1 in oo_.endo_simul(1,:). Check the size of this data. It apparetly has 0 rows.
댓글 수: 7
I was using this mod file to build my IRFs. Doesn’t seem like it has 0 rows. Where can I look for this information?
var Y w R I K A G C;
varexo ea eg;
parameters alphap betap deltap rhoa rhog omega chi;
alphap = 1/3; betap = 0.99; deltap = 0.02; rhoa = 0.97; rhog = 0.95; omega = 0.2; chi = 1;
model;
exp® = 1/betap - (1-deltap); exp(K) = (1/3)*((1 - betap*(1-deltap))/(alphap*betap))^(1/(alphap-1)); exp(Y) = (1/3)*((1 - betap*(1-deltap))/(alphap*betap))^(alphap/(alphap-1)); exp(I) = (deltap/3)*((1 - betap*(1-deltap))/(alphap*betap))^(1/(alphap-1)); exp(C) = exp(Y) * (1-omega) - exp(I); exp(w) = (1-alphap)*((1 - betap*(1-deltap))/(alphap*betap))^(alphap/(alphap-1)); G = (1-rhog)*omega*Y + rhog*G(-1) + eg; A = rhoa*A(-1) + ea;
end;
initval;
K = log(12.3); Y = log(1.1); A = 0; C = log(0.64); I = log(0.25); w = log(2.22); R = log(0.03); G = log(0.22);
end;
shocks; var eg; stderr 1; var ea; stderr 1; end;
steady; check;
stoch_simul(order=1, irf=20, periods=40);
Sorry, how does this code relate to oo_.endo_simul?
I would suggest opening oo_ in the variable editor and seeing what is contained in endo_simul
This is the code for neoclassical model with two shocks. I want to plot the IRFs based on the output of this model.
When I open oo_ endo_simul indeed contains only zeros. How do I fix this?
It sounds lke you have an error in your simulation code. Not sure we have enough information to be able to help with that, though.
Ayazhan Zhangalova
2021년 3월 16일
편집: Ayazhan Zhangalova
2021년 3월 16일
Oh, I actually found a mistake, thanks! I have one more question though. Could you please tell me what “vectors must be the same length” refers to?
In the context of plotting, this means your input for X has to be a vector the same length as Y. Otherwise, there are leftover numbers.
x=1:5;
y=[3 1];
plot(x,y)
Error using plot
Vectors must be the same length.
Vectors must be the same length.
Okay, got it. Thank you so much for answering!
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
