How To Approximate Data With Model
1 view (last 30 days)
Show older comments
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
0 Comments
Accepted Answer
Mathieu NOE
on 9 May 2022
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 Comments
More Answers (0)
See Also
Categories
Find more on Data Exploration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!