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 Center および File ExchangeDiscrete Data Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by