Вы находитесь на странице: 1из 26

Practical No 2

Aim:
Wrte a program to study and plot the basic signals sine, cosine and exponential

TOOLS AND VERSION USED:


MATLAB

THEORY
Sine function Y = sin(X) The sin function operates element-wise on arrays. The function's domains and ranges include complex values. All angles are in radians. Y = sin(X) returns the circular sine of the elements of X. The sine of an angle is:

Cosine function Y = cos(X) Y = cos(X) returns the cosine for each element of X. The cos function operates element-wise on arrays. All angles are in radians. The cosine of an angle is:

Exponential function Y = exp(X)

Y = exp(X) returns the exponential for each element of X. exp operates elementwise on arrays. For complex x + i * y, exp returns the complex exponential ez = ex(cos y + i sin y). Use expm for matrix exponentials.

MATLAB PROGRAM
Program for generation of sine signal t=0:10 u=sind(2*pi*10*t) plot(t,u) Program for generation of cosine signal t=0:10 u=cosd(2*pi*10*t) plot(t,u) Program for generation exponential signal t=0:10 u=exp(t) plot(t,u)

OUTPUT
Sine

Cosine

Exponential

RESULT
The sine wave, cosine wave and exponential function has been studied and plotted successfully.

Practical No 3(a)
Aim:
Wrte a program to study and plot unit step [u(n)-u(n-N)]

TOOLS AND VERSION USED:


MATLAB

THEORY
The unit step function, usually denoted by H(but sometimes u or ), is a discontinuous function whose value is zero for negative argument and one for positive argument. It seldom matters what value is used for H(0), since H is mostly used as a distribution. The unit step, as a function of a discrete variable n:

where n is an integer

MATLAB PROGRAM
Program for generation of unit step signal t=-5:5 u=[zeros(1,5) ones(1,6)] stem(t,u)

OUTPUT

RESULT
The unit step signal has been studied and plotted successfully.

Practical No 3(b)
Aim:
Write a program to study and plot unit impulse signal.

TOOLS AND VERSION USED:


MATLAB

THEORY
A unit impulse function, denoted by H (x) is not really a function in the normal sense, because it is generally defined as the limit of a function or through its properties. The general definition of a unit impulse function is

MATLAB PROGRAM
Program for generation of unit impuse signal t=-5:5 u=[zeros(1,5) ones(1,1) zeros(1,5)] stem(t,u)

OUTPUT

RESULT
The unit impulse signal has been studied and plotted successfully.

Practical No 3(c)
Aim:
Wrte a program to study and plot ramp signal.

TOOLS AND VERSION USED:


MATLAB

THEORY
The ramp function is an elementary unary real function, easily computable as the mean of its independent variable and its absolute value.

MATLAB PROGRAM
Program for generation of ramp signal t=-5:5 u=[zeros(1,6) 1 2 3 4 5] stem(t,u)

OUTPUT

RESULT
The ramp signal has been studied and plotted successfully.

Practical No 4
Aim:
Write a program for linear convolution of two sequences.

TOOLS AND VERSION USED:


MATLAB

THEORY
A convolution is an integral that expresses the amount of one function as it is shifted over another function. It therefore blends from one function to another. For example, in synthesis imaging, the measured dirty map is a convolution of the true CLEAN map with dirty beam. Y(n) = x(k)h(n-k) This formula gives response y (n) of the LTI system as a function of the input x(n)signal and the unit sample response h(n) is called CONVOLUTION SUM.

MATLAB PROGRAM
Program for producing linear convolution. a = [1 2 3] b = [2 3 4] c = conv (a, b) t= 0:4 stem (t, c)

OUTPUT

RESULT
Linear convolution of two sequences is convoluved successfully.

Practical No 5(a)
Aim:
To compute the cross correlation of the given sequence.

TOOLS AND VERSION USED:


MATLAB

THEORY
Correlation Correlation gives a measure of similarities between two given data sequences. In this process, two signal sequences are compared and the degree to which they are similar is computed. Cross Correlation Cross-correlation is a measure of similarity of two waveforms as a function of a time-lag applied to one of them. For continuous functions, f and g, the cross-correlation is defined as:

Where f * denotes the complex conjugate of f. Similarly, for discrete functions, the cross-correlation is defined as:

The cross-correlation is similar in nature to the convolution of two functions.

Properties

The correlation of functions f(t) and g(t) is equivalent to the convolution of f *(t) and g(t). I.e.:

If either f or g is Hermitian, then:

Analogous to the convolution theorem, the cross-correlation satisfies: Where denotes the Fourier transform, and an asterisk again indicates the complex conjugate. Coupled with fast Fourier transform algorithms, this property is often exploited for the efficient numerical computation of crosscorrelations.

The cross-correlation is related to the spectral density. (see Wiener Khinchin theorem) The cross correlation of a convolution of f and h with a function g is the convolution of the correlation of f and g with the kernel h:

MATLAB PROGRAM
Program for compute cross correlation.

OUTPUT

RESULT
Cross correlation of given sequence has been found successfully.

Practical No 5(b)
Aim:
To compute the Auto correlation of the given sequence.

TOOLS AND VERSION USED:


MATLAB

THEORY
Correlation Correlation gives a measure of similarities between two given data sequences. In this process, two signal sequences are compared and the degree to which they are similar is computed. Auto Correlation Autocorrelation is the cross-correlation of a signal with itself. Informally, it is the similarity between observations as a function of the time separation between them. It is a mathematical tool for finding repeating patterns, such as the presence of a periodic signal which has been buried under noise, or identifying the missing fundamental frequency in a signal implied by its harmonic frequencies. It is often used in signal processing for analyzing functions or series of values, such as time domain signals. Given a signal f(t), the continuous autocorrelation Rff() is most often defined as the continuous cross-correlation integral of f(t) with itself, at lag .

where represents the complex conjugate and * represents convolution. For a real function, . The discrete autocorrelation R at lag j for a discrete signal xn is

The above definitions work for signals that are square integrable, or square sum able, that is, of finite energy. Signals that "last forever" are treated instead as random processes, in which case different definitions are needed, based on expected values. For wide-sense-stationary random processes, the autocorrelations are defined as

For processes that are not stationary, these will also be functions of t, or n. For processes that are also ergodic, the expectation can be replaced by the limit of a time average. The autocorrelation of an ergodic process is sometimes defined as or equated to

These definitions have the advantage that they give sensible well-defined singleparameter results for periodic functions, even when those functions are not the output of stationary ergodic processes. Alternatively, signals that last forever can be treated by a short-time autocorrelation function analysis, using finite time integrals. (See short-time Fourier transforms for a related process.) Multi-dimensional autocorrelation is defined similarly. For example, in three dimensions the autocorrelation of a square-sum able discrete signal would be

When mean values are subtracted from signals before computing an autocorrelation function, the resulting function is usually called an auto-covariance function.

Properties In the following, we will describe properties of one-dimensional autocorrelations only, since most properties are easily transferred from the one-dimensional case to the multi-dimensional cases. A fundamental property of the autocorrelation is symmetry, R(i) = R( i), which is easy to prove from the definition. In the continuous case, The autocorrelation is an even function when f is a real function, and the autocorrelation is a Hermitian function when f is a complex function. The continuous autocorrelation function reaches its peak at the origin, where it takes a real value, i.e. for any delay , . This is a consequence of the CauchySchwarz inequality. The same result holds in the discrete case.

The autocorrelation of a periodic function is, itself, periodic with the same period. The autocorrelation of the sum of two completely uncorrelated functions (the cross-correlation is zero for all ) is the sum of the autocorrelations of each function separately. Since autocorrelation is a specific type of cross-correlation, it maintains all the properties of cross-correlation. The autocorrelation of a continuous-time white noise signal will have a strong peak (represented by a Dirac delta function) at = 0 and will be absolutely 0 for all other . The WienerKhinchin theorem relates the autocorrelation function to the power spectral density via the Fourier transform:

For real-valued functions, the symmetric autocorrelation function has a real symmetric transform, so the WienerKhinchin theorem can be re-expressed in terms of real cosines only:

MATLAB PROGRAM
Program for compute Auto correlation.

OUTPUT

RESULT
Cross correlation of given sequence has been found successfully.

Practical No 6
Aim:
Write a program for circular convolution of any two sequences.

TOOLS AND VERSION USED:


MATLAB

THEORY
Syntax c = cconv(a,b,n) Circular convolution is used to convolve two discrete Fourier transform (DFT) sequences. For very long sequences, circular convolution may be faster than linear convolution c = cconv (a, b, n) circularly convolves vectors a and b. n is the length of the resulting vector. If you omit n, it defaults to length (a) +length (B)-1. When n = length (a) +length (B)-1, the circular convolution is equivalent to the linear convolution computed with conv.

MATLAB PROGRAM
Program for circular convolution

OUTPUT

RESULT The circular convolution of two sequences is successfully convulsed.

Practical No 7
Aim:
Write a program to compute the dft of the sequence.

TOOLS AND VERSION USED:


MATLAB

THEORY
The sequence of N complex numbers x0, ..., xN1 is transformed into another sequence of N complex numbers according to the DFT formula: (Eq.1 ) The transform is sometimes denoted by the symbol [note 1] or or , as in

Eq.1 can be interpreted or derived in various ways, for example:

It completely describes the discrete-time Fourier transform (DTFT) of an Nperiodic sequence, which comprises only discrete frequency components. (Discrete-time Fourier transform# Periodic data) It can also provide uniformly-spaced samples of the continuous DTFT of a finite length sequence.

MATLAB PROGRAM
Program to compute the DFT of a sequence

OUTPUT

RESULT The discrete Fourier transform of the sequence is successfully computed.

Practical No 8
Aim:
Write a program to compute the FFT of the sequence.

TOOLS AND VERSION USED:


MATLAB

THEORY
A fast Fourier transform (FFT) is an efficient algorithm to compute the discrete Fourier transform(DFT) and its inverse. There are many distinct FFT algorithms involving a wide range of mathematics, from simple complex-number arithmetic to group theory and number theory An FFT computes the DFT and produces exactly the same result as evaluating the DFT definition directly; the only difference is that an FFT is much faster. (In the presence of round-off error, many FFT algorithms are also much more accurate than evaluating the DFT definition directly, as discussed below.) Let x0, ...., xN-1 be complex numbers. The DFT is defined by the formula

Evaluating this definition directly requires O(N2) operations: there are N outputs Xk, and each output requires a sum of N terms. An FFT is any method to compute the same results in O(N log N) operations. More precisely, all known FFT algorithms require (N log N) operations (technically, Only denotes an upper bound), although there is no known proof that better complexity is impossible.

MATLAB PROGRAM
Program to compute the FFT of a sequence

OUTPUT

RESULT The FFT of the sequence is successfully computed.

Вам также может понравиться