-
Notifications
You must be signed in to change notification settings - Fork 0
/
sig_sys_lab_01.m
70 lines (59 loc) · 1.28 KB
/
sig_sys_lab_01.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
clc
clear all
close all
%%%%%%%%%%%%%%%%%%%%%%%%
% plotting the continuous time signal
%%%%%%%%%%%%%%%%%%%%%%%%
%%to plot unitstep function
%define a range from -1 to 1 with equal gap of 0.01
t = (-1: 0.01: 1);
%define a zero of name unit step matrix size t
unitstep = zeros(size(t));
%define unitstep
unitstep (t>=0) = 1;
%drawing graph with line width = 3 and color blue
subplot(3,2,1);
plot(t,unitstep,'b', 'linewidth',3);
title('Unit step function');
xlabel('x axis');
ylabel('y axis');
%%to plot unit impulse function
%define unitimpulse
f2 = zeros(size(t));
f2 (t==0) = 1;
subplot(3,2,2);
plot(t,f2, 'b', 'linewidth',2)
title('unit impulse');
xlabel('x axis');
ylabel('y axis');
%%plot ramp function
ramp = zeros(size(t));
ramp = (t.*unitstep);
subplot(3,2,3);
plot(t,ramp,'b', 'linewidth',1);
title('ramp');
xlabel('x axis');
ylabel('y axis');
%%plot sin x
t1 = (-2*pi: 0.1: 2*pi);
a = sin(t1);
subplot(3,2,4);
plot(t1, a,'b', 'linewidth',1);
title('sin(x)');
xlabel('x axis');
ylabel('y axis');
%%plot of exponential
expo = zeros(size(t));
expo = exp(t);
subplot(3,2,5);
plot(t,expo);
title('exponential');
xlabel('x axis');
ylabel('y axis');
%%plot of random function
random = rand(size(t));
subplot(3,2,6);
plot(t,random)
title('random signal');
xlabel('x axis');
ylabel('y axis');