Experiment-1: AIM: To Perform Basic Operations On Signals, Generation of Various Software Required: Matlab 7.0.1 Programs
Experiment-1: AIM: To Perform Basic Operations On Signals, Generation of Various Software Required: Matlab 7.0.1 Programs
EXPERIMENT-1
AIM: To perform basic operations on signals,generation of various
Signals and finding its FFT.
SOFTWARE REQUIRED: MATLAB 7.0.1
PROGRAMS:
Signal Addition & Multiplication:
clc;
clf;
t=0:0.0001:0.002;
f=500;
f1=7000;
w=2*pi*f;
w1=2*pi*f1;
x1=sin(w*t);
x2=sin(w1*t);
subplot(2,2,1);
x3=x1+x2;
subplot(2,2,1);
plot(t,x3);
subplot(2,2,2);
stem(t,x3);
x4=x1.*x2;
subplot(2,2,3);
plot(t,x4);
subplot(2,2,4);
stem(t,x4);
OUTPUT WAVEFORMS:
Shifting:
clc;
clf;
y1=[zeros(1,10),1,zeros(1,10)]
n=-10:10
subplot(1,3,1);
stem(n,y1);
xlabel('sample index,n');
ylabel('amplitude');
title('unit impluse sequence');
y2=[zeros(1,15),1,zeros(1,5)];
n=-10:10;
subplot(1,3,2);
stem(n,y2);
xlabel('sample index,n');
ylabel('amplitude');
title('advanced unit impluse sequence');
y3=[zeros(1,5),1,zeros(1,15)];
n=-10:10;
subplot(1,3,3);
stem(n,y3);
xlabel('sample index,n');
ylabel('amplitude');
title('delayed unit impluse sequence');
OUTPUT WAVEFORMS:
Folding:
clc;
clf;
n=[-4:4];
a=[1,1,2,3,4,5,6,7,7]
subplot(2,2,1);
stem(n,a);
subplot(2,2,2);
plot(n,a);
b=fliplr(a);
subplot(2,2,3);
stem(n,b);
subplot(2,2,4);
plot(n,b);
OUTPUT WAVEFORMS:
TIME SCALING:
clc;
clf;
t=0:0.0001:0.002;
f=1000;
w=2*pi*f;
y=sin(w*t);
subplot(3,2,1);
plot(t,y);
subplot(3,2,2);
stem(t,y);
y1=sin((w*t)/2);
subplot(3,2,3);
plot(t,y1);
subplot(3,2,4);
stem(t,y1);
y2=2*sin(w*t);
subplot(3,2,5);
plot(t,y2);
subplot(3,2,6);
stem(t,y2);
5
OUTPUT WAVEFORMS:
CONVOLUTION:
clc;
clear all;
close all;
x=input('enter the 1st sequence');
h=input('enter the 2nd sequence');
y=conv(x,h);
subplot(3,1,1);
stem(x);
xlabel('inputseq1');
ylabel('Amplitude');
subplot(3,1,2);
stem(h);
xlabel('inputseq2');
ylabel('Amplitude');
subplot(3,1,3);
stem(y);
xlabel('outputseq3');
6
ylabel('Amplitude');
disp('The resultant signal is');y
OUTPUT WAVEFORMS:
7
stem(phase(M));
xlabel('real axis');
ylabel('imaginary axis');
title('phaseresponse');
OUTPUT WAVEFORMS:
8
stem(phase(M));
xlabel('real axis');
ylabel('imaginary axis');
title('phaseresponse');
OUTPUT WAVEFORMS:
9
stem(phase(M));
xlabel('real axis');
ylabel('imaginary axis');
title('phaseresponse');
OUTPUT WAVEFORMS:
10
stem(abs(M));
xlabel('real axis');
ylabel('imaginary axis');
title('magnituderesponse');
subplot(1,3,3);
stem(phase(M));
xlabel('real axis');
ylabel('imaginary axis');
title('phaseresponse');
OUTPUT WAVEFORMS:
11
stem(abs(M));
xlabel('real axis');
ylabel('imaginary axis');
title('magnituderesponse');
figure(3);
stem(phase(M));
xlabel('real axis');
ylabel('imaginary axis');
title('phaseresponse');
OUTPUT WAVEFORMS:
12
13
GENERATION OF TRAINGULAR SIGNAL
clc;
clf;
y=0:.5:2
for j=0:8
a=(2*j)+y
plot(a,y,'b')
hold on
end
x=2:2:18
for k=0:.01:2;
b=k;
plot(x,b,'b')
hold on
end
hold off
k=length(y);
M=fft(y,k);
figure(2);
stem(abs(M));
xlabel('real axis');
ylabel('imaginary axis');
title('magnituderesponse');
figure(3);
stem(phase(M));
xlabel('real axis');
ylabel('imaginary axis');
title('phaseresponse');
OUTPUT WAVEFORMS:
14
15
16
RESULT: Basic operations on signals are performedand various signals are
Generted and their FFTs are found