필터 지우기
필터 지우기

How can I plot an equation to its time lag?

조회 수: 3 (최근 30일)
sergi quintana
sergi quintana 2020년 3월 29일
댓글: sergi quintana 2020년 3월 30일
I am using MATLAB to solve an economic model and I would like to plot in a graph consumption in period t+1 and consumption in period t. The equation for consumption is:
where are parameters that I can choose the value but correspond to the sequence defined above. Since I know consumption in period 0, , I can solve for the sequence using a loop. However, I do not know how to plot consumption to its lag in a graph.
Thanks for your help!!
  댓글 수: 2
Image Analyst
Image Analyst 2020년 3월 29일
What does "to its lag" mean? If you want to plot consumption, just use the plot() function after the loop.
sergi quintana
sergi quintana 2020년 3월 29일
As you can see I have a sequence whose values I don't know. I just know the first value of the sequence (Period 0 consumption). I would like to plot the evolution of this sequence with ct+1 on the y-axis and ct on the x-axis. Maybe now is more clear.
Thanks for your interest!

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

답변 (1개)

darova
darova 2020년 3월 29일
Use for loops
c(1) = w + (1-b)*(1+r)*a0 + D;
for t = 1:n-1
c(t+1) = (1+r)*(c(t)-ch)*b + ch;
end
plot(1:n,c)
  댓글 수: 1
sergi quintana
sergi quintana 2020년 3월 30일
Thanks for your interest! However, it seems I was not clear with my problem. I would like to plot c(t+1) on y-axis and c(t) on the x-axis. The graph you propose just plots c on the y-axis and time on the x-axis. Maybe now is more clear. Anyway thanks for helping!

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

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by