Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

11/17/22 9:28 PM MATLAB Command Window 1 of 2

>> l1=1:10

l1 =

1 2 3 4 5 6 7 8 9 10

>> l2=1:1:10

l2 =

1 2 3 4 5 6 7 8 9 10

>> l3=10:-1:1

l3 =

10 9 8 7 6 5 4 3 2 1

>> l4=1:0.3:pi

l4 =

1.0000 1.3000 1.6000 1.9000 2.2000 2.5000 2.8000 3.1000

>> l1(2)=l3(3)

l1 =

1 8 3 4 5 6 7 8 9 10

>> l4(3:5)=[1,2,3]

l4 =

1.0000 1.3000 1.0000 2.0000 3.0000 2.5000 2.8000 3.1000

>> l4(3:5)=[]

l4 =

1.0000 1.3000 2.5000 2.8000 3.1000

>> l5=linspace(1,5,5)

l5 =

1 2 3 4 5

>> help linspace


linspace Linearly spaced vector.
linspace(X1, X2) generates a row vector of 100 linearly
11/17/22 9:28 PM MATLAB Command Window 2 of 2

equally spaced points between X1 and X2.

linspace(X1, X2, N) generates N points between X1 and X2.


For N = 1, linspace returns X2.

Class support for inputs X1,X2:


float: double, single

See also logspace, colon.

Documentation for linspace


Other uses of linspace

>> who

Your variables are:

l1 l2 l3 l4 l5

>> whos
Name Size Bytes Class Attributes

l1 1x10 80 double
l2 1x10 80 double
l3 1x10 80 double
l4 1x5 40 double
l5 1x5 40 double

>> clear l1 l2 l3 l5
>> who

Your variables are:

l4

>> clc

You might also like