Gistlib Logo

gistlib

create vector running from six to one in matlab

To create a vector running from six to one in MATLAB, you can use the colon operator with a negative step size. Here's how you can do it:

main.m
vector = 6:-1:1;
17 chars
2 lines

This will create a vector starting from 6 and decrementing by 1 to 1. The resulting vector will be [6, 5, 4, 3, 2, 1].

similar matlab code snippets

multiple graphs linspace in matlab
the sum optimization in matlab
create a time vector from 0-5 in increments of 0.2 in matlab
creating a while loop updating values that doesnt equal mode in matlab
how to replace each element of a array with the row cell of another array in matlab
how to plot a line given hessian normal form in matlab
sums the values of those elements of “x” that are lower than 26. in matlab
counts the number of elements in vector “x” that have values between 14 and 42 and creates a new vector “y” that contains only the elements of “x” in that specified range. in matlab
create a 1 x 100 vector of x values according to -15<x<0 and use elementwise operators to create 3 more 1x100 vectors in matlab
how to calculate the moving maximum of a vector in matlab

related categories

matlab
vectorization

gistlibby LogSnag