Current location - Trademark Inquiry Complete Network - Futures platform - How to write this futures calculation in MATLAB code?
How to write this futures calculation in MATLAB code?
I and i- 1 are common expressions of mathematical formulas. When using a program, the initial index usually starts from 0 or 1. I- 1 and I only expressed the relationship between the latter and the former.

In this regard, if there is a bug, it should be adjusted quickly:

n = 5; %5 years

RF(ii)= zero (n,1); % forwarding rate initialized to all zero column vector.

r =[2; 3; 3.7; 4.2; 4.5]; % ratio

t =[ 1:N]'; % Grade 1-5

for ii= 1:N

RF(ii+ 1)=(R(ii+ 1)* T(ii+ 1)-R(ii)T(ii))/(T(ii+ 1)-T(ii));

end

RFmx=[( 1:N)',RF]; % is expressed in two columns according to the requirements of the topic.