Professional Documents
Culture Documents
Lab Report # 1
Lab. Experiment Name
Task -1:
What does the following command do?
v(:)
ANS: This command is used to show the whole matrix or row given convert into single column.
e.g
x=
1 2 3
4 5 6
>> x(:)
ans =
e.g y=linspace(2,3,5)
y=
e.g
A= 1 2 3
4 5 6
7 8 9
>> A(2,:)
ans =
4 5 6
>> A(:,2:3)
Here row can be access through out the given matrix in the given command here we access the all
rows of the matrix but 2nd and 3rd column will be access.
e.g
A(:,2:3)
ans =
2 3
5 6
8 9
After 3 terminator terminate the value so 4 comes in next row so similarly after 6 terminator come and
it terminate the value in next row.
4 5
7 8
As [2 3] mean 2nd and 3rd row access and [1 2] mean 1st and 2nd column access in the upper given matrix.
size(A)
ans =
3 3
Size command give the total size of row and column in a matrix so upper matrix have 3*3 dimension.
Task (4): Type the following commands and observe the plot
t = -5:.01:5;
y = sin (2*pi*t);
plot (t,y);
z = cos (2*pi*t);
plot(t,y,'r',t,z,'k')
output
Stem:
Basically stem command is used for discrete time graph it make the patch of continuous graph so it
show us the discrete value
Figure
If we draw more then one graph and we want to draw in more then one graph for comparison
so we used figure command so we see the 2 different figure.
Hold
Hold command is used stop or retain the graph to draw another graph to show the only one graph so it
it’s only possible in Discrete time graph
Subplot
Subplot command is used to draw more then one graph in one figure to compare in same figure and if
you draw more then one graph so using this command we can plot more then one graph .
END