Page 824 - Mechatronics with Experiments
P. 824
810 MECHATRONICS
ans =
0 + 1.0000i
>> j
ans =
0 + 1.0000i
>> i=2.0
i =
2
>> v= 5+10∗i
v =
25
>> i
i =
2
>> clear
>> i
ans =
0 + 1.0000i
>>
A large vector can be assigned as follows using a starting value, increment value, and
final value,
>> x = 0: 1:100 ; % x=[0 1 2 . . . . . 100];
By default, vectors are row vectors of (1xn). To change a vector into a column vector,
simply use the transpose operator,
>> x = x’ ; % Original x is a row vector.
% After this statement it is a column vector.
Defining matrices with rows and columns as follows is often needed, as shown below.
Notice how we transpose the row vectors into column vectors in the definition of the matrix
>> Angle_Degrees = [ 0 90 180 270 360]
Angle_Degrees =
0 90 180 270 360
>> Angle_Radians = (pi/180) ∗ Angle_Degrees
Angle_Radians =
0 1.5708 3.1416 4.7124 6.2832
>> Angle_Matrix = [Angle_Degrees’ , Angle_Radians’ ]