How To Approximate Data With Model

2 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Axis Labels 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by