MATLAB|财务内部收益率的歪歪

今天看财务内部收益率,无聊的,就用MATLAB花了下曲线(#.#)。好久没碰过MATLAB,真实连最基本的语言格式都忘了。

财务净现值函数曲线FNPV(i)

1686568-5485b5ea26d50d97.png

例子

  • 现金流量表
1686568-65fa6f1b33a8a425.png
  • 现金流量图
1686568-0dd4bf3966da212d.png
  • 财务净现值与折现率的函数曲线
1686568-23e9f7717bb400d5.png
  • 本例MATLAB绘图程序
i=(-10:0.5:30)/100; % 折现率
i_all=length(i);  % 折现率的数目
n=10; % 总年数
CICO=[0 -4 -4 -4 -5 5 5 5 5 5]; % 假定的净现金流量
FNPV=zeros(1,i_all);   % 财务净现值,是i的函数
for is=1:1:i_all    % 计算
    i_temp=i(1,is);
    for t=1:1:n
        FNPV(1,is)=FNPV(1,is)+CICO(1,t)*(1+i_temp)^(-t);
    end  
end
% 绘图
figure;
plot(i,FNPV,'r','linewidth',3);
hold on;
plot(i,FNPV*0,'b','linewidth',1.5);
plot([0,0],[min(FNPV)*1.5,max(FNPV)*1.1],'b','linewidth',1.5);
% 
ylim([min(FNPV)*1.5,max(FNPV)*1.1]);
set(gca,'Position',[.14 .16 .82 .81],'FontName','宋体','FontSize',14,'LineWidth',1.5);
xlabel('折现率i','FontSize',20,'FontWeight','normal','Color','black');
ylabel('FNPV','FontSize',20,'FontWeight','normal','Color','black');
set(gca,'XMinorTick','on');set(gca,'YMinorTick','on');

转载于:https://www.jianshu.com/p/5b9f696a156d

猜你喜欢

转载自blog.csdn.net/weixin_33724059/article/details/91088036