**The previous post contained the various programs for DSP. In this post I will try to explain some of the basics of DSP. [The design of Filters will be discussed in later posts].**

**If you want save this post for reading it later, download the PDF from the link below-**

**Understanding DSP .PDF [114 kb]**

**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**

**Fourier Transform**

**The whole of DSP depends on the Fourier analysis. By learning the philosophy behind this, one can easily master the subject.**

**Fourier transform is not a device and is not an output of a system. It is just a tool that helps us understand the system better. It defines a system. It defines the relation between a certain input and a certain output.**

**Using Fourier series any signal can be expressed in terms of periodic signals such as sine and/or cosine.**

**But why express using these basic signals (sine/cosine)?**

**The reason is that they are periodic. Periodicity guarantees that they repeat again and again (according to a known rule). In other words, periodicity of signals implies that they have a frequency of occurrence. And thus expressing a test signal in terms of those signals whose frequencies are already known is nothing but the Fourier expansion. By doing so and keeping the basic signals in mind, we can gain knowledge about the characteristics of that test signal.**

**Why don’t we express all signals using a square wave?**

**We**

**can****express signals in terms of square wave. But the frequency for the square wave is not unique and has many components.**

***Actually to build a square wave, we need infinite sinusoidal components. And interestingly to build a sine wave, we need infinite square waves. We only have a one-sided advantage.**

**It is probably better to express using sinusoidal signals since most of the practical applications involve sinusoidals.**

**Need for Fourier analysis?**

**Suppose you want to remove the disturbances recorded from the microphone along with audio signals.**

**If we try to test each and every sampled quantity of the recording, we will never be able to separate the audio from the noise. Since the audio and noise could be present together. And we cannot say whether the given sampled quantity is noise or audio. To solve this problem, we look for other properties that can distinguish between the audio and the noise. That property is the frequency spectrum.**

**Components of DSP**

**There are circuits which produce a characteristic output for a certain type of input. Thus to understand why the systems behave as they do, we use Fourier analysis. And by using Fourier analysis, we can build better circuits which provide optimum outputs.**

**Broadly classifying there are two types of circuits:**

**1.**

**A circuit which modifies an input signal. If it increases the magnitude, it is an Amplifier. If it decreases the magnitude, it is an Attenuator.**

**2.**

**A circuit which segregates an input signal. If it removes certain frequencies from the signal, then it is a Filter. If it adds certain frequencies to the signal, it is a Mixer.**

**The circuits can be a combination of both. Ex: a circuit can be both an amplifier as well as a filter.**

**What is the use of these groups?**

**By using the two groups listed above we can get whatever output we want using a particular input. This is why we study the design of these systems (to get an output we want). This can be shown by the example below-**

**If input is represented by i[a,b] – i as a function, from a to b.**

**By using Amplifiers and Attenuators we can increase or decrease ‘i’ respectively.**

**Ex: 2*i[a,b] is an Amplifier, ¼*i[a,b] is an attenuator**

**By using Filters and Mixers we can modify ‘i’.**

**Ex: i[a,p] is a filter where p lies between a & b, i[q,b] is a Mixer where q lies outside a & b.**

**These are the only operations that you would ever perform in a DSP system. Now by looking at the example above, isn’t it easy to obtain any required output? It sure is.**

**Sampling theorem**

**The whole of Fourier analysis is based on the essence of this simple yet intriguing theorem.**

**The theorem signifies the constraint that has to be fulfilled to save the information in the signals.**

**We can draw a line curved upwards or down. Two upward peaks cannot be present in a line segment neither can two downward peaks be. If they did exist, then we can break them into two separate curves.**

**Imagine a small segment of a signal. Let us try to apply the analogy from the above example. A signal can have only one upward peak and only one downward peak. This is nothing but a sine wave of one oscillation.**

**To read (trace) this sine wave, we need to probe the wave twice (once for each peak). Thus to read the sample sine wave we need another sine wave with 2 oscillations in the same period (or sine wave with twice the frequency of the given wave).**

**Now suppose a sample needs to be read using another signal. What characteristics should the signal possess?**

**1.**

**If the sample is to be read then we must know the smallest duration of upward or downward peaks.**

**2.**

**We now take the smallest peak duration and find a sine wave that fits it.**

**3.**

**Now we use another sine wave which has twice the number of oscillations and is used as the sampling signal.**

**The corresponding steps in frequency domain are:**

**1.**

**Take Fourier transform of the signal.**

**2.**

**Find the largest frequency component.**

**3.**

**Take a signal with twice this frequency and use it as the sampling signal.**

**Thus the three steps explain how to satisfy Nyquist criterion.**

**Impulse response**

**If we say -**

**He is a carpenter**

**OR**

**He is a person who converts a block of wood into a chair.**

**-Both mean the same.**

**So if we say-**

**It is a Low Pass filter**

**OR**

**It is a circuit which removes high frequency components from the input.**

**-They are still the same.**

**Impulse response is an identity of the system. Defining Impulse response is as good as defining a system. Impulse response defines a system by quoting the relationship between input and output.**

**How can Impulse response describe a system?**

**Good question. As always we will understand it using an example.**

**Suppose, the rebate offered in a shop is 15%. Can’t we calculate the money saved when we purchase items for Rs.1300?**

**We know per hundred it is 15, so for 1300 it is 195.**

**Similarly if we know what is the output for an Impulse, we can definitely calculate what is the output for any signal.**

**(Digital signals are nothing but a train of impulses with different magnitudes. The output is the joint action of all the components together.)**

**Must we use only Impulse response to define a system?**

**No. We can use even step response to define a system. And with step response we can get back the impulse response.**

**It is like expressing money in different currencies. It can always be inter-converted.**

**Using Impulse response to define a system is the convention followed.**

**Convolution**

**Convolution is a method for evaluating the output. All Digital signals can be expressed using impulses. By doing so, we have a train of impulses with different magnitudes (or weights) [Equation 1]. We already know from the discussion above the output for impulse is impulse response. Thus the output for the train of impulse with different weights is nothing but the impulse response multiplied by the respective weights [Equation 2].**

**-Where x[k] is the magnitude of the k**

^{th}

**sample, δ[n-k] is the**

**k samples****delayed impulse.**

**-Where x[k] is the magnitude of the k**

^{th}

**sample, h[n-k] is the**

**k sample****delayed impulse response.**

**Note that the variables in the summation can be interchanged but y[n] remains unchanged. Equation 2 can also be re-written as-**

**Filters**

**As discussed, Filters play important role in digital systems. To obtain optimum performance is the goal for designing filters. The filters are classified as follows-**

**1.**

**Analog**

**a.**

**Infinite Impulse response**

**b.**

**Finite Impulse response**

**2.**

**Digital**

**a.**

**Infinite Impulse response**

**b.**

**Finite Impulse response**

**The classification of digital filters is based upon its impulse response. Thus depending upon whether a filter is IIR or FIR we use suitable design strategies.**

**What IIR or FIR?**

**A system is like the neighbors’ dog. You wave at it once [**

**Impulse****] and it starts barking [**

**impulse response****]. Now if it keeps on barking then it is an infinite response. If it barks only few times, then it is a finite response.**

**What use will it be to know if a filter is IIR or FIR?**

**Now continuing the above example- if you already knew that the dog barks few times, you will be calm. If the dog barks whole night, it’ll drives you crazy. But if the barking gradually dies down you will keep your cool.**

**It is the inherent property of FIR filters to be stable. A bounded input**

**always****produces bounded output (- a finite response). However, IIR filters may or may not be stable. They can be assumed stable if their response dies down eventually (even at infinity).**

**So, depending upon the user’s demands for stability, ease of design and ease of implementation we chose between IIR and FIR filters.**

**Whatever we learned till now was not actually DSP. This is just a brief overview. But the joy of learning DSP doesn’t end here.**