You can write a program to generate the series of numbers you want using a for loop. Here is an example code that generates the series a(n) = 1, 2, 3, 4, 5:
main.m94 chars6 lines
Output:
main.m10 chars2 lines
In this code, we first create a vector of zeros with 5 elements using the zeros
function. We then use a for
loop to iterate over the values 1 through 5 and set the corresponding element of the vector a
equal to the loop variable i
. Finally, we print the resulting vector using the disp
function.
gistlibby LogSnag