フィルターのクリア

How To Approximate Data With Model

2 ビュー (過去 30 日間)
econogist
econogist 2022 年 5 月 6 日
回答済み: Mathieu NOE 2022 年 5 月 9 日
I have a model that spits out TFPmodel as shown in the code below. I want to show how the vector called TFPmodel can approximate actual TFP growth (realgA in code below) from 1950 to 2100. The problem is TFPmodel is a size of 1X31. Is there any way I can get this to approximate the whole period so it looks like the other ("Other.png") attached image?
realdata=readmatrix('RATM.csv');
Year=realdata(:,1);
realgA=realdata(:,2);
TFPmodel=[0 0.01 0.012 0.015 0.02 0.025 0.025 0.025 0.025 0.025 0.026 0.025 0.026 0.025 0.025 0.025 0.025 0.025 0.025 0.025 0.025 0.025 0.025 0.025 0.025 0.025 0.025 0.025 0.025 0.025 0.025];
plot(Year, realgA, 'r--', 'LineWidth', 1.5)
set(gca,'FontName','Times','FontSize',11);
ylabel('TFP growth (g_A)','FontSize',11)
ylim([-0.01 0.05])
yticks([-0.01 0 0.01 0.02 0.03 0.04 0.05])
xlim([1950 2100])
hold on
grid on
box on

採用された回答

Mathieu NOE
Mathieu NOE 2022 年 5 月 9 日
hello
maybe this ?
clc
clearvars
realdata=readmatrix('RATM.csv');
Year=realdata(:,1);
realgA=realdata(:,2);
TFPmodel=[0 0.01 0.012 0.015 0.02 0.025 0.025 0.025 0.025 0.025 0.026 0.025 0.026 0.025 0.025 0.025 0.025 0.025 0.025 0.025 0.025 0.025 0.025 0.025 0.025 0.025 0.025 0.025 0.025 0.025 0.025];
TFPmodel2 = interp1((0:numel(TFPmodel)-1)./numel(TFPmodel),TFPmodel,(0:numel(Year)-1)./numel(Year));
plot(Year, realgA, 'r--', 'LineWidth', 1.5)
hold on
plot(Year,TFPmodel2)
grid on
set(gca,'FontName','Times','FontSize',11);
ylabel('TFP growth (g_A)','FontSize',11)
ylim([-0.01 0.05])
yticks([-0.01 0 0.01 0.02 0.03 0.04 0.05])
xlim([1950 2100])
box on

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAxis Labels についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by