How to plot data from excel
6 views (last 30 days)
Show older comments
Hi,
I'm trying to replicate a specific study (not that familiar with Matlab) and I am having some troubles understanding the matlab code.
I want to compare the model with my data, but the output only shows the simulated model in the graph and not the data from excel (dependency ratio).
Hope someone can help me out on this :)
years = 1990:5:2100;
% Years to consider (110 years simulation horizon)
start_yr = 1990;
end_yr = 110/5;
% Dependency ratio
dep_ratio_data = xlsread('EER-D-16-00235_data','dep_ratio');
for i = 1:end_yr+1
dep_ratio_mod(i) = psi_base(5*i-3);
end
figure(3)
plot(years,100*dep_ratio_mod,years,dep_ratio_data(:,2),'r--')
ylim([0 80])
xlim([1990 2100]);
title('Dependency Ratio')
ylabel('per cent');
tickx = [1990:10:2100];
set(gca,'XTick',tickx);
set(gca,'XTickLabel',[1990:10:2100])
legend('Model','Data','Location','SouthEast')
set(gcf,'Units','inches');
screenposition = get(gcf,'Position');
set(gcf,...
'PaperPosition',[0 0 screenposition(3:4)],...
'PaperSize',screenposition(3:4));
print -dpdf -painters dep_ratio_model_data
0 Comments
Answers (0)
See Also
Categories
Find more on Spreadsheets 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!