0% found this document useful (0 votes)
286 views13 pages

Signal Generation: Experiment - 1 Aim:-To Generate and Plot Various Signals Using Matlab

The document describes 12 experiments to generate and plot various signals using MATLAB. The experiments generate and plot signals including the unit impulse, unit step function, decaying exponentials, sinusoids, combinations of sinusoids, ramp functions, gate functions, and the sinc function. Code is provided to generate each of the signals and plot the results.

Uploaded by

Ravi Goyal
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)
286 views13 pages

Signal Generation: Experiment - 1 Aim:-To Generate and Plot Various Signals Using Matlab

The document describes 12 experiments to generate and plot various signals using MATLAB. The experiments generate and plot signals including the unit impulse, unit step function, decaying exponentials, sinusoids, combinations of sinusoids, ramp functions, gate functions, and the sinc function. Code is provided to generate each of the signals and plot the results.

Uploaded by

Ravi Goyal
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/ 13

EXPERIMENT - 1

SIGNAL GENERATION
Aim :- To generate and plot various signals using
MATLAB:-
1. Unit Impulse δ(n)

Code :-
n=-10:10;
impulse = n ==0;
stem(n,impulse);
xlabel('n');
ylabel('Amplitude');
title('Impulse_ 6049');

Output:-
2. δ(n-3)

Code :-

n=-10:1:10;
impulse = n ==3;
stem(n,impulse);
xlabel('n');
ylabel('Amplitude');
title('Impulse(n-3)_ 6049');

Output :-
3. Unit step u(n)

Code :-

n=-10:10;
unit = n >=0;
stem(n,unit);
xlabel('n');
ylabel('Amplitude');
title('Unit Step_ 6049');

Output :-
4. u(n-3)

Code :-
n=-10:10;
unit = n >=3;
stem(n,unit);
xlabel('n');
ylabel('Amplitude');
title('u(n-3)_ 6049');

Output :-
5. u(n)-5u(n-5)

Code :-

t=-10:10;
unit1=(t>=0);
unit2=(t>=5);
x=(unit1-5.*unit2);
stem(t,x);
xlabel('n');
ylabel('Amplitude');
title('u(n)-5u(n-5)_ 6049');

Output :-
6. x(n) = (0.9)^n , n>=0,

0,n<0;

Code :-

n=linspace(-50,50,51);
unit = n>=0;
x= ((0.9).^n).*unit;
stem(n,x);
xlabel('n');
ylabel('Amplitude');
title('(0.9)^n_ 6049');

Output :-
7. x(n) = (0.9)n-3 , n>=3;
0, n<3;

Code :-

n=linspace(-50,50,50);
unit = n>=3;
x= ((0.9).^(n-3)).*unit;
stem(n,x);
xlabel('n');
ylabel('Amplitude');
p=sprintf('(0.9)raised to power(n-3)_6049');
title(p);

Output :-
8.x(n) = 4Cos(0.1nπ + π/3)

Code :-

n=linspace(-10,10,40);
x=4*cos((0.1*n*pi)+(pi/3));
stem(n,x);
xlabel('n');
ylabel('Amplitude');
title('4Cos(0.1*n*pi + pi/3)_ 6049');

Output :-
9.x(n) = 4Cos(0.1nπ + π/3) + 3Sin(0.3nπ + π)

Code :-

n=linspace(-10,10,50);
x=4*cos((0.1*n*pi)+(pi/3))+3*sin((0.3*n*pi)+pi);
stem(n,x);
xlabel('n');
ylabel('Amplitude');
title('4Cos(0.1*n*pi + pi/3) + 3sin((0.3 *n*pi)+pi)_ 6049');

Output :-
10. x(n) = r(n) - r(n-5)-5u(n-5)

Code :-

t=-20:20;
unit=(t>=0);
unit1=(t>=5);
unit2=(t>10);
ramp1=(t.*unit);
ramp2=((t-5).*unit1);
x=ramp1-ramp2-5*unit2; stem(t,x); xlabel('n');
ylabel('Amplitude');
title('r(n)-r(n-5)-5u(n-10)_ 6049');

Output :-
11. Gate Funtion
x(n) = A , -N>n>N;
0, otherwise;

Code :-

n=-10:10;
N=input('Enter N : ');
A=input('Enter A : ');
u1= n>=-N;
u2= n>=N+1;
stem(n,A*(u1-u2)); xlabel('n');
ylabel('Amplitude');
title('Gate Function_ 6049');

Output : Enter N : 7
Enter A : 3
12. Sinc(n) = Sin(πn)/πn

Code :-
t=linspace(-2*pi,2*pi,51);
y=sinc(t);
stem(y);
xlabel('n');
ylabel('Amplitude');
title('Sinc(n)_ 6049');

Output :-

Amplitude

You might also like