I have a 40 period model and want to assign the variable x1, x2...x40 names without having to write the same subroutine 40 times. I remember in Fortran and Pascal we use to assign the variable x an index i, hence xi. Then use a Do Loop to calculate x1 through x40 without having to write out the routine 40 times. I'm trying to make heads or tails out of the manual, but am having a difficult time. Is there a way I can make the calculation 40 times doing the routine once instead of 40 times?
For example, suppose x1 = y1 + a, and x2 = y2 + a...x40=y40+a
In Fortran we would write a program something like this:
In the following program I didn't have
to write out x2=y2+a, x3=y3+a...etc.
Is there a similar procedure in Gnu Octave? How would I write an equivalent program to the above in Gnu Octave?