0% found this document useful (0 votes)
92 views16 pages

Experiment-1: AIM: To Perform Basic Operations On Signals, Generation of Various Software Required: Matlab 7.0.1 Programs

The document describes experiments performed in MATLAB to generate various signals, perform basic operations on signals, and calculate the fast Fourier transform (FFT) of each signal. The experiments generate and analyze impulse, step, ramp, exponential, sawtooth, triangular, and sinusoidal signals. Plots of the time and frequency domain representations are produced for each signal. The aim is to familiarize with basic signal operations and representations in MATLAB.

Uploaded by

Vicky Vinay
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
92 views16 pages

Experiment-1: AIM: To Perform Basic Operations On Signals, Generation of Various Software Required: Matlab 7.0.1 Programs

The document describes experiments performed in MATLAB to generate various signals, perform basic operations on signals, and calculate the fast Fourier transform (FFT) of each signal. The experiments generate and analyze impulse, step, ramp, exponential, sawtooth, triangular, and sinusoidal signals. Plots of the time and frequency domain representations are produced for each signal. The aim is to familiarize with basic signal operations and representations in MATLAB.

Uploaded by

Vicky Vinay
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 16

1

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:

GENERATION OF IMPULSE SIGNAL:


clc;
clf;
x1=[zeros(1,10),1,zeros(1,10)];
n=-10:10;
subplot(1,3,1);
stem(n,x1);
xlabel('sampleindex');
ylabel('amplitude');
title('unit impulse sequence');
N=length(x1);
M=fft(x1,N);
subplot(1,3,2);
stem(abs(M));
xlabel('real axis');
ylabel('imaginary axis');
title('magnituderesponse');
subplot(1,3,3);

7
stem(phase(M));
xlabel('real axis');
ylabel('imaginary axis');
title('phaseresponse');
OUTPUT WAVEFORMS:

GENERATION OF STEP SIGNAL:


clc;
clf;
N=20;
x1=ones(1,N);
n=0:1:N-1;
subplot(1,3,1),
stem(n,x1);
xlabel('sample index');
ylabel('amplitude');
title('Unit Step Sequence');
k=length(x1);
M=fft(x1,k);
subplot(1,3,2);
stem(abs(M));
xlabel('real axis');
ylabel('imaginary axis');
title('magnituderesponse');
subplot(1,3,3);

8
stem(phase(M));
xlabel('real axis');
ylabel('imaginary axis');
title('phaseresponse');

OUTPUT WAVEFORMS:

GENERATION OF RAMP SIGNAL


clc;
clf;
x1=[zeros(1,10),0:10];
n=-10:10
subplot(1,3,1);
stem(n,x1)
xlabel('sample index,n')
ylabel('amplitude')
title('unit ramp sequence')
k=length(x1);
M=fft(x1,k);
subplot(1,3,2);
stem(abs(M));
xlabel('real axis');
ylabel('imaginary axis');
title('magnituderesponse');
subplot(1,3,3);

9
stem(phase(M));
xlabel('real axis');
ylabel('imaginary axis');
title('phaseresponse');
OUTPUT WAVEFORMS:

GENERATION OF EXPONENTIAL SIGNAL


clc;
clf;
a=0.8;
n=0:10;
x1=a.^n;
subplot(1,3,1);
stem(n,x1);
xlabel('sample index,n');
ylabel('amplitude');
title('exponential sequence for a=0.8');
k=length(x1);
M=fft(x1,k);
subplot(1,3,2);

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:

GENERATION OF SAWTOOTH SIGNAL


clc;
clf;
y=0:0.5:2;
for j=0:3
x=(4*j)+y;
plot(x,y)
hold on
end
for k=0:3;
x=(4*k)-y
plot(x,y)
hold on
end
hold off
k=length(y);
M=fft(y,k);
figure(2);

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

GENERATION OF SINUSOIDAL SIGNAL


clc;
clf;
N=20;
n=0:1:N-1;
x1=sin(0.2*pi.*n);
subplot(1,4,1);
stem(n,x1);
subplot(1,4,2);
plot(n,x1);
xlabel('n');
ylabel('x1');
title('Sinusoidal Sequence');
k=length(x1);
M=fft(x1,k);
subplot(1,4,3);
stem(abs(M));
xlabel('real axis');
ylabel('imaginary axis');
title('magnituderesponse');
subplot(1,4,4);
stem(phase(M));
xlabel('real axis');
ylabel('imaginary axis');
title('phaseresponse');
OUTPUT WAVEFORMS:

16
RESULT: Basic operations on signals are performedand various signals are
Generted and their FFTs are found

You might also like