combining 3 graphs from different codes.

조회 수: 5 (최근 30일)
Eashan
Eashan 2023년 7월 9일
댓글: Eashan 2023년 7월 9일
I am trying to replicate a model that corresponds to the New Keynesian model used in Leeper, Traum and Walker (2017). There is a .mod file where I am changing the parameters and there is a .m file that runs the .mod file using dynare, combines the 40 graphs in the .mod file and subplots 12 output into 1 graph.
My problem is, I have 2 other modified version of the .mod file, so I want to combine the result of these 2 graphs over the 1st graph so that they are comparable.

채택된 답변

Voss
Voss 2023년 7월 9일
Try the modified run.m file attached. I added a for loop to loop over the three .mod files (you'll have to supply their names), runnning dynare on each and plotting each set of results into the same 12 subplots, with a different line color for each model. After the for loop, the other stuff you're doing (setting the subplot title, adding a horizontal line at y=0, setting axis tight) is done once for each subplot.
You may want to add (a) legend(s) to indicate which lines correspond to each model. Since the legend would be the same for each of the 12 subplots, it makes sense to have one legend for all subplots instead. To do that, you can use tiledlayout instead of subplot, as shown here, or do it with subplots as shown here.
  댓글 수: 1
Eashan
Eashan 2023년 7월 9일
Thanks. This is working (with a minor adjustment in subplot_titles). Overall, great solution!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Discrete Data Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by