SNS Lab File
SNS Lab File
1
SIGNALS AND
SYSTEMS LAB
Submitted to: N
Jayanthi Submitted
by: Saiyam Soni
COE
Department 2K18/EC/147
Batch E1,
ECE
TABLE OF CONTENTS
S.NO. TOPIC DONE ON CHECKED ON SIGNATURE
2
EXPERIMENT 1
Aim: Write a MATLAB program to generate sine, cosine, exponential, unit-step and ramp signal
waveforms
Theory:
A= Amplitude
ω=frequency in radians/second
3
When Sine wave starts from zero and covers positive values, reaches zero, and again covers
negative values, reaches zero, it is said to have completed one cycle or single cycle. The upper part
of sine wave is called positive cycle and the lower part is called negative cycle in a single cycle.
For different values of time, the Signal gives the values of quantity at that time. Therefore, the
signal is a function of time.
2. Cosine signal: A cosine wave is a signal waveform with a shape identical to that of a sine wave ,
except each point on the cosine wave occurs exactly 1/4 cycle earlier than the corresponding point
on the sine wave. A cosine wave and its corresponding sine wave have the same frequency, but
the cosine wave leads the sine wave by 90 degrees of phase.
C and a=constants
e=mathematical constant=2.71828
4
4. Ramp signal: Can be represented as
Code:
1. Sine signal:
t=0:0.1:2*pi;
y=sin(t);
plot(y);
title('sine function');
xlabel('t');
ylabel('y=sin(t)');
2. Cosine signal:
5
t=0:0.1:2*pi;
y=cos(t);
plot(y);
title('cos function');
xlabel('t');
ylabel('y=cos(t)');
3. Exponential signal:
t=0:0.1:10;
y=exp(t);
plot(y);
title('exponential function');
xlabel('t');
ylabel('y=exp(t)');
4. Ramp signal:
t=0:10;
y=t;
plot(y);
title('Ramp function');
xlabel('t');
ylabel('y=t');
5. Unit-step signal:
T=10;
6
a=[];
for t=1:10
y=1;
else
y=0;
end
a=[a y];
end
plot(a);
title(‘Unit-step function’);
xlabel('t');
ylabel('y(t)');
or
T=10;
a=[];
for t=1:10
y=1;
else
y=0;
end
a=[a y];
7
end
stem(a);
title(‘Unit-step function’);
xlabel('t');
ylabel('y(t)');
Output:
1. Sine signal:
2. Cosine signal:
3. Exponential signal:
8
4. Ramp signal:
5. Unit-step signal:
9
Result: We were able to generate sine, cosine, exponential, ramp and unit-step signal
waveforms.
EXPERIMENT 2
Aim: Write a MATLAB program to generate signals and perform different operations such as
addition, subtraction, multiplication and division on them
10
Code:
t=0:0.1:10;
y1=sin(t);
y2=cos(t);
a=y1+y2;
b=y1-y2;
c=y1.*y2;
d=y1./y2;
subplot(3,2,1);
plot(y1);
title('sine function');
xlabel('t');
ylabel('y1=sint');
subplot(3,2,2);
plot(y2);
title('cos function');
xlabel('t');
ylabel('y2=cost');
subplot(3,2,3);
plot(a);
title('Addition');
xlabel('t');
ylabel('a=y1+y2');
subplot(3,2,4);
plot(b);
11
title('Subtraction');
xlabel('t');
ylabel('b=y1-y2');
subplot(3,2,5);
plot(c);
title('multiplication');
xlabel('t');
ylabel('c=y1.*y2');
subplot(3,2,6);
plot(d);
title('Division');
xlabel('t');
ylabel('d=y1./y2');
12
Output:
Result: We were able to generate two signals and perform operations such as addition,
subtraction, multiplication and division on them.
13