Introduction To Matrices in Matlab LAB # 02
Introduction To Matrices in Matlab LAB # 02
MATRICES IN MATLAB
LAB # 02
Spring 2020
CSE301L Signals & Systems Lab
“On my honor, as student of University of Engineering and Technology, I have neither given nor received
unauthorized assistance on this academic work.”
Submitted to:
Engr. Durr-e-Nayab
Date 3/03/2020
-------------------------TASK 01--------------------------
Problem Analysis:
We have to make a new matrix B from A by the following condition.
Algorithm:
We have given a matrix say A and to make another say B.
Copy the column of A not changing any element.
Subtract column 1 of A from column 2 of A ,it will be the second column of B.
Subtract column 2 of A from column 3 of A ,it will be the third column of B.
Code:
%Matrix A
disp('Matrix A is: ')
A=[13 6 9;1 4 8;2 8 17 ]
%Matrix B
disp('Matrix B is: ')
B=[A(:,1),A(:,2)-A(:,1),A(:,3)-A(:,2)]
OUTPUT:
Figure 1 output
Figure 2
2.3 SUB-MATRICES:
Code:
>> x = [0.0:0.1:2.0]';
>> y = sin(x);
>> [x y]
Output:
Discussion and Conclusion:
By doing this we learnt that we can add two-rand signal and we can add it to each other’s.
-------------------------TASK 03--------------------------
A note on colon notation
Problem Analysis:
Generate the sequences.
Algorithm:
First we have to generate the sequence.
To write side it goes up to 69.75 and to left side it goes to -65.25.
The difference between each corresponding element will be 7.5.
CODE:
%Generate the Sequence difference b/e each two element is 0.25
X=-65.25:7.5:69.75
OUTPUT:
Figure 3
OUTPUT:
Figure 7
Discussion and Conclusion:
We can drive sub matrices from ant matrix. We can select the any rows and column from the matrix and
thus is the conclusion of the given task.
-------------------------TASK 06--------------------------
Problem Analysis:
To check built in function round, ciel, floor and fix.
Algorithm:
Take a matrix f of values floating point.
Then apply all the above function.
CODE: OUTPUT:
OUTPUT: