Professional Documents
Culture Documents
1.Sine wave-The sine wave or sinusoid is a mathematical curve that describes a smooth
repetitive oscillation.The signal repeats itself after a period of 2pi. Its most basic form as a
function of time (t) is:
The sine function attains maximum value of 1 at angles (n+i)pi/2 and value 0 at n*pi.
2.Cosine wave- 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 .
3.Exponential signal-A real exponential signal is defined as
Where both "A" and "" are real. Depending on the value of "" the signals will be different.
If "" is positive the signal x(t) is a growing exponential and if "" is negative then the
signal x(t) is a decaying exponential. For =0, signal x(t) will be constant.
4.Impulse signal-The Dirac delta function or unit impulse or often referred to as the delta
function, is the function that defines the idea of a unit impulse in continuous-time. Informally,
this function is one that is infinitesimally narrow, infinitely tall, yet integrates to one. Perhaps the
simplest way to visualize this as a rectangular pulse from a -D/2 to a +D/2 with a height of 1/D.
As we take the limit of this setup as D approaches 0, we see that the width tends to zero and the
height tends to infinity as the total area remains
constant at one.
The impulse function is often written as
If the magnitude at 0 is 1 unit then the function is termed as unit impulse function.
5.Unit step function-The Heaviside step function, or the unit step function, usually denoted
by H (but sometimes u or ), is adiscontinuous function whose value is zero for negative
argument and one for positive argument.
An alternative form of the unit step, as a function of a discrete variable n:
It has a value 0 for x<0 and a value r(x)=x for positive x. Thus forming a line with slope 1 for
x>0.
CODE:
a=[-2*pi:pi/12:2*pi];
b=[-1:.1:1];
c=[-20:1:20];
d=[-5:0.05:5];
e=[-20:20]
i=1;
for m=-20:20
if(m<0)
u(i)=0
else
u(i)=m
end
i=i+1
end
p=sin(a);
q=cos(a);
r=exp(b)
s=[zeros(1,20),ones(1,1),zeros(1,20)]
t=[zeros(1,100),1,ones(1,100)]
subplot(3,2,1)
plot(a,p)
xlabel('x')
ylabel('sin(x)')
title('Sine curve')
subplot(3,2,2)
plot(a,q)
xlabel('x')
ylabel('cos(x)')
title('Cosine curve')
subplot(3,2,3)
plot(b,r)
xlabel('x')
ylabel('e^x')
title('Exponential function')
subplot(3,2,4)
stem(c,s)
xlabel('time')
ylabel('del(t)')
title('Impulse function')
subplot(3,2,5)
plot(d,t)
xlabel('time')
ylabel('u(t)')
title('Unit step function')
subplot(3,2,6)
plot(e,u)
xlabel('time')
ylabel('r(t)')
title('Ramp function')
OUTPUT:
EXPERIMENT-2
For complex-valued functions f, g defined on the set Z of integers, the discrete convolution of f
and g is given by
The convolution theorem for z transforms states that for any (real or)
complex causal signals
in the domain, i.e.,
and
where
, and
CODE:
clear all
close all
clc
w=-2*pi:0.1:2*pi;
s1=[2 2 3 7];
s2=[4 5 6];
t=conv2(s1,s2);
[h,w]=freqz(s1,1,w);
[p,w]=freqz(s2,1,w);
r=h.*p;
[m,n]=invfreqz(r,w,5,0);
subplot(2,2,1)
stem(s1);
xlabel('n-->')
ylabel('s1')
title('Signal 1')
subplot(2,2,2)
stem(s2);
xlabel('n-->')
ylabel('s2')
title('Signal 2')
subplot(2,2,3)
stem(t);
xlabel('n-->')
ylabel('conv')
title('Convolution')
subplot(2,2,4);
stem(m);
xlabel('n-->')
ylabel('I')
title('Inverse transform')
OUTPUT:
EXPERIMENT-3
Function used:
[h,w] = freqz(b,a,n) returns the n-point frequency response vector, h, and the
corresponding angular frequency vector, w, for the digital filter with numerator and
denominator polynomial coefficients stored in b and a, respectively.
For eg the frequency response of the filter
H(z)= 1+ 2z-1 + 3z-2
can be calculated by taking
b=[1 2 3] and a=[1]
CODE:w=-pi:0.1:pi;
num=[1 2 3];
den=[4 5 6];
[h,w]=freqz(num,den,w);
mag=abs(h);
phase=angle(h);
subplot(3,1,1)
zplane(num,den);
subplot(3,1,2)
plot(w/pi,mag);
xlabel('Magnitude -->')
ylabel('Frequency -->')
title('Magnitude plot')
subplot(3,1,3)
plot(w/pi,phase);
xlabel('Phase -->')
ylabel('Frequency -->')
title('Phase plot')
OUTPUT:
EXPERIMENT-4
The first condition provides stability for (or continuous-time) linear systems, and
the second case relates to stability of discrete-time linear systems. A polynomial
with the first property is called at times a Hurwitz polynomial and with the second
property a Schur polynomial.
A system is defined to be BIBO Stable if every bounded input to the system results
in a bounded output over the time interval . This must hold for all initial times to.
So long as we don't input infinity to our system, we won't get infinity output.
A signal is bounded if there is a finite value
magnitude never exceeds , that is
For a discrete time LTI system, the condition for BIBO stability is that the impulse
response be absolutely summable, i.e.
Schr-Cohn Test:
Consider:
Define:
The Schr-Cohn Stability test states that the polynomial Am(z) has all of its
roots inside the unit circle if and only if the reflection coefficients, Km , satisfy the
condition |Km|<1 for all m=1,2 ..... N . The reflection coefficients are found from
the following recursion:
where Km = am(m)
CODE:
n=input('Enter order of denominator polnomial
for i=1:n+1
a(i)=input('');
end
coeff=0;
coeff=a/a(1);
e=1;
flag=0;
for i=1:n
b=fliplr(coeff);
disp(coeff)
disp(b)
k=b(e);
if (k>1||k<-1)
flag=1;
break;
end;
temp=(coeff-k*b)/(1-(k^2));
for j=1:n+1;
coeff(j)=temp(j);
end
e=e+1;
end
if flag==1
disp('Unstable System ')
else if flag==0
disp('Stable System')
end
end
');
OUTPUT:
EXPERIMENT-5
AIM- Write a MATLAB code to show cross-correlation and autocorrelation of signals. Also show the auto-correlation and
convolution of unit step function
THEORY:
In signal processing, cross-correlation is a measure of similarity of two series as a
function of the lag of one relative to the other. This is also known as a sliding dot
product orsliding inner-product. It is commonly used for searching a long signal
for a shorter, known feature. It has applications in pattern recognition, single
particle analysis, electron tomography, averaging, cryptanalysis,
and neurophysiology.
for discrete functions, the cross-correlation is defined as:
Cross-correlations are useful for determining the time delay between two signals,
e.g. for determining time delays for the propagation of acoustic signals across a
microphone array
is
CODE:
close all
clear all
clc
x=[1 4 1 3]
y=[2 5 6 7 1]
z=fliplr(x);
m=1:7;
n=1:8;
p=conv2(x,z);
q=conv2(z,y);
subplot(2,2,1)
stem(n,q)
xlabel('n -->')
ylabel('Rxy(n)-->')
title('Cross-Correlation')
subplot(2,2,2)
stem(m,p)
xlabel('n -->')
ylabel('Rxx(n)-->')
title('Auto-Correlation')
ut=[ones(1,11)]
r1=conv2(ut,ut);
g=0:20;
subplot(2,2,3)
stem(g,r1)
xlabel('n -->')
ylabel('Conv(n)-->')
title('Convolution[Unit step]')
h=-10:10;
ft=fliplr(ut)
r2=conv2(ut,ft);
subplot(2,2,4)
stem(h,r2)
xlabel('n -->')
ylabel('Ruu(n)-->')
title('Auto-Correlation[Unit Step]]')
OUTPUT: