ASSIGNMENT: 2
Assignment: 2
TITLE: SIMULATION OF SIGNALS USING MATLAB.
PROGRAM 1:
OBJECT: Test program to generate bipolar square waveform:-
n=0:1:60;
y=square(n);
stem(n,y);
xlabel(‘n’);
ylabel(‘amplitude’);
title(‘generation of bipolar square wave sequence’)
Now write bipolar and unipolar square wave sequence without using “square” command
SOURCE CODE(PART-I):
n=0:1:60;
y= square(n);
/* square(T) generates a square wave with period 2*Pi for the elements of time vector T*/
stem(n,y);
xlabel('n');
ylabel('amplitude');
title('generation of bipolar square wave signal');
OUTPUT GRAPH:
[pic]
SOURCE CODE(PART-II):
c=10;
x=[];
d=[ones(1,5) -ones(1,5)];
for i=1:c
x=[x d]
end
stem(x);
xlabel('n');
ylabel('amplitude');
title('generation of bipolar square wave signal');
OUTPUT GRAPH:
[pic]
SOURCE CODE(PART-III):
c=10;
x=[];
d=[ones(1,5) zeros(1,5)]; /* ones(N) is an N-by-N matrix of ones.*/
for i=1:c
x=[x d];
end
stem(x);
xlabel('n');
ylabel('amplitude');
title('generation of unipolar square wave signal');
OUTPUT GRAPH:
[pic]
PROGRAM 2:
OBJECT: Test program to generate bipolar sawtooth waveform:-
n=0:1:60;
y=sawtooth(n);
/* sawtooth(T) generates a sawtooth wave with period 2*pi for the elements of time vector T */
stem(n,y);
xlabel(‘n’);
ylabel(‘amplitude’);
title(‘generation of bipolar sawtooth wave sequence’)
Now write bipolar and unipolar sawtooth wave sequence without using “sawtooth” commend. ( use for loop)
SOURCE CODE(PART-I):
n=0:1:60;
y= sawtooth(n);
stem(n,y);
xlabel('n');
ylabel('amplitude');
title('generation of bipolar sawtooth wave signal');
OUTPUT GRAPH:
[pic]
SOURCE CODE(PART-II):
c=10;
x=[];
d=[ones(1,10)] ;
for i=1:c
x=[x d*i];
end
stem(x);
xlabel('n');
ylabel('amplitude');
title('generation of unipolar sawtooth wave signal');
OUTPUT GRAPH:
[pic]
SOURCE CODE(PART-III):
c=6;
x=[];
a=1;
for j=1:c
for i=0:10
x=[x a*i];
end
a=-a;
for i= 10:-1:1;
x=[x a*i];
end
a=-a;
end
stem(x);
xlabel('n');
ylabel('amplitude');
title('generation of bipolar saw tooth wave signal');
OUTPUT GRAPH:
[pic]
PROGRAM 3:
OBJECT: Generate the following sequence:-
[pic]
SOURCE CODE:
c=4;
x=[];
a=0;
for j=1:c
for i=0:4
x=[x (a*i+4)];
end
a=a+1;
for i= 1:4
x=[x (a*i+4)];
end
a=-a;
for i= 4:-1:1;
x=[x (a*i-4)];
end
a=a+1;
for i=0:4
x=[x (a*i-4)];
end
end
stem(x);
xlabel('n');
ylabel('amplitude');
title('generation of bipolar saw tooth wave signal');
OUTPUT GRAPH:
[pic]
PROGRAM 4:
OBJECT: Generate a unit step sequence with n sample. Generate a sinusoidal sequence with 1 period. Use the function sin(0.1*pi*n).Generate an exponential sequence (0.8)^n. Add two sinusoidal sequences sin(0.1*pi*n) and sin(0.2*pi*n). Use “subplot” to plot all the sequence.
SOURCE CODE:
s=input('enter the no. of samples:');
n=0:1:(s-1);
y1=[ones(1,s)];
subplot(2,2,1);
stem(y1);
y2=sin(0.1*pi*n);
subplot(2,2,2);
stem(y2);
y3=exp(.8.^n);
subplot(2,2,3);
stem(y3);
y4=sin(.1*pi*n);
y5=sin(.2*pi*n);
y6=y4+y5;
subplot(2,2,4);
stem(y6);
OUTPUT:
enter the no. of samples:30
OUTPUT GRAPH:
[pic]
PROGRAM 5:
OBJECT: Generate a unit impulse sequences ∂0 (n+4) and ∂0 (n-3).
SOURCE CODE(PART-I):
n=-10:20;
x=[zeros(1,6) 1 zeros(1,24)]; /*zeros(N) is an N-by-N matrix of zeros*/.
stem(n,x);
xlabel('time index n');ylabel('amplitude');
title('advanced impulse response');
axis([-10 20 0 1]);
OUTPUT GRAPH:
[pic]
SOURCE CODE(PART-II):
z=-10:20;
x=[zeros(1,13) 1 zeros(1,17)];
stem(n,x);
xlabel('time index n');ylabel('amplitude');
title('delayed impulse response');
axis([-10 20 0 1]);
[pic]
PROGRAM 6:
OBJECT: Write a program to generate a unit step sequence of length 20. Modify the program to generate a delayed and advance unit step sequence of [ U0(n+7),U0 (n-9)].
SOURCE CODE(PART-I):
n=0:1:20;
x=[ones(1,21)];
stem(n,x);
xlabel('time index n');ylabel('amplitude');
title('unit step sequence');
axis([0 20 0 1]);
OUTPUT GRAPH:
[pic]
SOURCE CODE(PART-II):
n=-10:1:20;
x=[zeros(1,13) ones(1,18)];
stem(n,x);
xlabel('time index n');ylabel('amplitude');
title('unit advanced step sequence');
axis([-10 20 0 1]);
OUTPUT GRAPH:
[pic]
PROGRAM 7:
OBJECT: Generate a unit impulse with arbitrary sift.
SOURCE CODE:
n=-10:1:20;
k=input('enter the value of shift:');
x=[zeros(1,(10-k)) 1 zeros(1,(20+k))];
stem(n,x);
xlabel('time index n');ylabel('amplitude');
title('shifted impulse sequence');
axis([-10 20 0 1]);
OUTPUT:
enter the value of shift:6
OUTPUT GRAPH:
[pic]
PROGRAM 8:
OBJECT: Take a sequence and perform folding and shifting operation on it. Use subplot notation to plot the normal order, folded order and shifted order.
SOURCE CODE:
t1=-3;
t2=3;
k=input('enter the value of shift:');
n=t1:1:t2;
n1=(t1-(k*(k>0))):1:(t2+abs(k*(k0))) s zeros(1,abs(k*(k ................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- a patient in a hospital is required to have at least 84
- assignment 2
- the matlab notebook v1 5
- matlab graphical user interface for processing images of
- test plan unit and integration template
- mathematical modeling of chemical processes
- chapter 8 discrete time signals and systems
- tangent techno labs
- linear systems laboratory 8
- wireless feedback structural control with embedded computing
Related searches
- 2 01 english 3 assignment advertising
- assignment 2 measurement
- 2 04 english 3 assignment flvs
- assignment 2 01 english 3 flvs
- term 2 assignment 2020
- mathematical literacy term 2 assignment grade10
- maths literacy grade 10 assignment 2 memo
- assignment 2 maths literacy grade 10
- mathematical literacy assignment 2 2021
- 2019 assignment 2 mathematics literacy grade 10
- mathematical literacy grade 10 assignment 2019 term 2 memo
- mathematical literacy grade 10 assignment 2 2019