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

Department of Mechanical Engineering

TME- 462 Computer Aided Design


Programming Lab 1
Instructor : Dr. Rakesh Saxena

1. Vector and Matrix Manipulation


a. Generating Vectors c. Empty Matrices
>> x = 1:5 >> A(:,[1,2]) = []
x = A=
1 2 3 4 5 3
6
b. Subscripting 9
>> A = [1 2 3;4 5 6;7 8 9]
A=1 2 3
4 5 6
7 8 9 Practice Problems
>> A(1:3,2) 1. Z = 6:-2:1
ans = 2. K = linspace(-pi,pi,4)
2 3. A(:,3:-1:1)
5 4. A(3:-1:1,:)
8

2. Graphics (3-D )
t = 0:pi/50:10*pi; plot3(sin(t), cos(t),t);

3. Solution of Simultaneous Equations


Solve: x + 2y = 5 and 3x + 4y = 6. A = [1 2;3 4]; B = [5 6] , C = A\B’

You might also like