combining 3 graphs from different codes.
5 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
采纳的回答
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Discrete Data Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!