Tuesday, 19 November 2013

DSP lab variations


DSP LAB QUESTIONS

1.        Write a MATLAB program so that output signal is sampled with a rate a) greater than twice the max frequency content in the input signal and b) for equal to maximum frequency content in the input signal. Given input signal is a cos function and the spacing between the samples is 50µs and total time duration is 0.05 seconds.
2.       Write a MATlAB program to find the system function of the causal LTI system with input x(z)= 1+2z-1+2z-2+z-3 and output y(z)= 1+z-1+2z-2+z-3 so plot input, output and impulse response.
3.       Write a MATLAB program to find convolution of unit imulse function with X(z)= 1+3z-1+4z-2 and convoluted output length is equal to sum of two input lengths-1.
4.       Write a MATLAB program to find the output of given system whose frequency response is Y(z)= X(z).H(z) and given x(n)= (1,2,3,4), h(n)= (1,2,3,4) and output length is equal to maximum length of x(n) and h(n).
5.        Write a MATLAB program to find convolution of two given sequences in time domain X1(z)= 1+2z-1+3z-2 & X2(z)= 2+z-1+4z-2 and convoluted output length is equal to sum of two input lengths minus one.
6.       Write a MATLAB program to find the similarities between the given sequence x(n)= Sin(2*pi*n/N) for N=4 and the time shifted version of same sequences in terms of convolution and write and verify a) Energy property b) periodicity property and draw the graph for the same.
7.        Write a program using MATLAB code for the received signal replected from the target is the delayed uerreon of the transmitted signal. Assume delay in two time units. Assume transmitted signal is {3, -1, 2, 1}.
8.       Write a MATLAB program to find the similarities between the two given sequence X1 (n)= [1 3 -2 1 2 -1 4 4 2] and X2(n)= [2 -1 4 1 -2 3] is its time shifted version which is shifted by two units, in terms of convolution and prove i) ϒxy[l]= ϒxy[-l] and 2) cross correlation of two sequences x(n) and y(n)= x(n-k) is having peak at the value of k.
9.       Write a MATLAB program to find the steady state response for the given difference equation y(n)-0.8y(n-1)=x(n) and x(n)= cos(0.05*pi*n); n=0 to N-1 where N=20 and plot the respective graph.
10.     Write a MATLAB program to find the first 8 samples of the complete response y(n) for the difference equation y[n]= 1/3 {x[n]+x[n-1]+x[n-2]}+0.95y[n-1]-0.9025y[n-2]; n>=0 where x(n)=cos(n*pi/3)u(n) and initial conditions are y[-1]=-2, y[-2]=-3, x[-1]=1, x[-2]=1.
11.      Write a MATLAB program to find the impulse response of a given difference equation y(n)+0.8y(n-2)+0.6y(n-3)=x(n)+0.7x(n-1)+0.5x(n-2). Plot the graph for N=20.
12.     Find steady state response using MATLAB for the difference equation y(n)-0.8y(n-1)= x(n) and x(n)= Cos(wn); n=0 to N-1 where N=20.
13.     Write a MATLAB program to find the multiplication of two frequencies domain aperiodic signals in the domain x1=[1 1 1 1] and x2=[1 2 3 4].
14.     Write a MATLAB program to find the multiplication of the two frequency domain periodic signals in time domain x1=[1 1 1 1] and x2=[1 2 3 4].
15.     Design an FIR filter for the given order of filter is 33 and cut-off frequency is 150Hz and sampling frequency is 1KHz and having stop band attenuation 21dB. Implement the same filter with assumed sinusoidal input.
16.     Write a MATLAB program to design an FIR filter is 2 and cut-off frequency is 150 and sampling frequency is 1KHz and having minimum stop band attenuation 44dB, Write a MATLAB program to implement the same filter with assumed sine input.
17.     Design an IIR filter for the pass band edge frequency w1=800 and stop band edge frequency w2=1200. sampling frequency ws=3600, passband ripple 1dB and stopband attenuation 40dB by using butterworth filter and maps it with bilinear transform. Find and plot the magnitude and frequency response. Implement with 3 various sinusoidal input signals of your own specification.

CCS PROGRAM:

18.     Linear convolution of a given sequence.
19.     Circular convolution of two sequences.
20.    Computation of N-point DFT for given value of N.
21.     Impulse response of given first order or second order filter.

Sunday, 20 October 2013

Digital Signal Processing lab interfacing programs

Digital Signal Processing lab interfacing programs...

To verify, Download C,C++ compiler from
https://www.facebook.com/groups/163904047131828/


alt+c   compile
alt+r   run
alt+f open file functions
alt+enter   exit full screen mode..

Note:1: Copy the programs and save as  filename.c  at  C:\TurboC++\Disk\TurboC3\BIN
          and directly run the programs from compiler.
         2:While running these progrms on CCStudio,Linux remove following commands from program.
                    a)#include<conio.h>
                    b)clrscr();
                    c)getch();

Expt no.1
Linear convolution


#include<stdio.h>
#include<conio.h>
#include<math.h>
main()
{

float x[15],y[15],h[15];
int i,j,m,n;
clrscr();

printf("\n Enter the value of m:");
scanf("%d",&m);
printf("\n Enter the first sequence:");
for(i=0;i<m;i++)
scanf("%f",&x[i]);

printf("\n Enter the value of n:");
scanf("%d",&n);
printf("\n Enter the second sequence:");
for(i=0;i<n;i++)
scanf("%f",&h[i]);

for(i=0;i<m+n-1;i++)
{
y[i]=0;
for(j=0;j<=i;j++)
y[i]+=x[j]*h[i-j];
}
for(i=0;i<m+n-1;i++)
printf("\n Linear convolution =%f\n",y[i]);
getch();

 }

Expt no.2
Circular convolution


#include<stdio.h>
#include<conio.h>
#include<math.h>
main()
{
int m,n,i,j,k;
float x[30],h[30],y[30],x2[30],a[30];
clrscr();
printf("Enter the length of the first sequence:\n");
scanf("%d",&m);
printf("Enter the first sequence:\n");
for(i=0;i<m;i++)
scanf("%f",&x[i]);
printf("Enter the length of the second sequence:\n");
scanf("%d",&n);
printf("Enter the second sequence:\n");
for(j=0;j<n;j++)
scanf("%f",&h[j]);
/*If length of both sequences are not equal*/
if(m-n!=0)
{
if(m>n) /* Pad the smaller sequence with zero*/
{
for(i=n;i<m;i++)
h[i]=0;
n=m;
}
for(i=m;i<n;i++)
x[i]=0;
m=n;
}
y[0]=0;
a[0]=h[0];
for(j=1;j<n;j++) /*folding h(n) to h(-n)*/
a[j]=h[n-j];
/*Circular convolution*/
for(i=0;i<n;i++)
y[0]+=x[i]*a[i];
for(k=1;k<n;k++)
{
y[k]=0;
/*circular shift*/
for(j=1;j<n;j++)
x2[j]=a[j-1];
x2[0]=a[n-1];
for(i=0;i<n;i++)
{
a[i]=x2[i];
y[k]+=x[i]*x2[i];
}
}
/*displaying the result*/
printf(" the circular convolution is\n");
for(i=0;i<n;i++)
printf("%f ",y[i]);
getch();
}


Expt no.3
N point DFT

#include <stdio.h>
#include <math.h>
#include<conio.h>

void dft(int *x, short k, float *real, float *imaginary);
float pi = 3.141592654;
float real[10],imaginary[10]; //Output results
int index=0;
int N,x[10]={0};

void main()
{
 short i,j;
 clrscr();
 printf("\nEnter the length of the input sequence:");
 scanf("%d",&N);
 printf("\nEnter the input sequence:");
 for(i=0;i<N;i++)
 scanf("%d",&x[i]);
  printf("\n The %d point DFT of sequence is \n",N);
 for (j = 0; j < N; j++)
    {
     dft(x,j,real,imaginary);                 //call DFT function
    }
}

void dft(int *x, short k, float *real, float *imaginary)  //DFT function
{
 float sumRe = 0;                        //initialize real component
 float sumIm = 0;                        //initialize imaginary component
 int i = 0;
 float cs = 0;                         //initialize cosine component
 float sn = 0;                          //initialize sine component

 for (i = 0; i < N; i++)                 //for N-point DFT
    {
      cs = cos(2*pi*(k)*i/N);           //real component
      sn = sin(2*pi*(k)*i/N);           //imaginary component
      sumRe = sumRe + x[i]*cs;        //sum of real components
      sumIm = sumIm - x[i]*sn;        //sum of imaginary components
    }
    real[index]=sumRe;
    imaginary[index]=sumIm;
 index++;

 printf("\n%f+j*%f\n",sumRe,sumIm);
 getch();
}


Expt no.4
Impulse response

#include<stdio.h>
#include<conio.h>
#define Order 2
#define Len 5

float h[Len] = {0.0,0.0,0.0,0.0,0.0},sum;

void main()
{
int j,k;
float a[Order+1] = {0.5311, 0.8622, 1.1311};
float b[Order+1] = {.2009, -0.7478, 0.5722};
clrscr();
printf("Impulse response of the given system:\n");
for(j=0;j<Len;j++)
{
sum = 0.0;
for(k=1;k<=Order;k++)
{
if((j-k)>=0)
sum = sum+(b[k]*h[j-k]);
}
if(j<=Order)
{
h[j] = a[j]-sum;
}
else
{
h[j] = -sum;
  }
printf("%f ",h[j]);
}
getch();

}




Thursday, 3 October 2013

Sunday, 29 September 2013

Smith chart


Smith chart

Smith chart is a graphical aid for solving transmission line problems very easily which would be tedious to solve by using analytical methods.




1.        Smith chart consist of resistance and reactance circles.

  r=Rl\Zo
  x=Xl\Zo
  where Zl=Rl+jXl
hence in smith chart. This process is called “normalization”.
and the ratio (Zl\Zo) is called “per unit load impedence” or “normalized impedence”.


2.       Plotting of impedence: Any complex impedence can be shown by a single point on the
               Smith chart . this point is intersection of “r=Rl\Zo” and “x=jXl\Zo”.







EXAMPLE : Let Zl = 120+j160 Ω  and Z0=400 Ω
       Normalising we get,
r=0.3
x=0.4
zl=0.3+j0.4Ω  shown on Smith chart.

                                                
                                                                  BLACK MAGIC DESIGN






3.       VSWR Determination:
With “O” as centre and OA as radius a  circle is drawn  which cuts right side of the horizontal axis at “r” value of 3.9 (shown as point B)
This gives value of VSWR = ρ = 3.9

4.       Determination of Γ in magnitude and direction:
The line oa in figure is produced to meet the outer circle at point C
The angle at point C= Ɵ=133.2° is the phase angle of reflection coefficient.
To find magnitude of  Γ , the linear scale at bottom of chart is refered  which is marked
“voltage reflection coefficient”. With O as centre and radius exactly wqual to “OA”,
An arc is cut on left side.
The value of | Γ | is read as 0.6
Therefore Γ=0.6∟133.2°

5.       Location of  Vmax  and  Vmin  : The constant ρ circle intersects the central horizontal axis at
Points D and B.
Vmax = Rmax\Zo  =rmax = 3.91
Vmin = Rmin\Zo  = rmin = 0.26

6.       Open and short circuit line:
At point F on the horizontal axis r= , x= this represents open circuit termination of line.
At point E in the horizontal axis r=0 , x=0  this represents short circuit termination of line.

7.        Movement along periphery :
Movement in clockwise direction from point E results in no of wavelengths towards generator
Movement in anti-clockwise direction from point E results in no of wavelengths towards load.
One full rotation on pheriphery corresponds to λ\2.

8.       Conversion of impedence to admittance:
To find admittance of an impedence at point a, the point a is rotated through constant S-circle
By an amount λ\4  which is equivalent to 180°.
The point yl is diametrically opposite to “A” or (zl) has a value,
yl = 1.2-j1.6.














Monday, 23 September 2013

DSP Viva questions


DIGITAL SIGNAL PROCESSING  (DSP)   VIVA QUESTIONS:




1.       What is sampling theorem?
2.      What do you mean by process of reconstruction.
3.      What are techniques of reconstructions.
4.      What do you mean Aliasing? What is the condition to avoid aliasing for sampling?
5.       Write the conditions of sampling.
6.      How many types of sampling there?
7.      Explain the statement-
t= 0:0.000005:0.05
8.      In the above example what does colon (:) and semicolon (;) denotes.
9.      What is  a) Undersampling     b) nyquist plot             c) Oversampling.
10.   Write the MATLAB program for Oversampling.
11.   What is the use of command ‘legend’?
12.   Write the difference between built in function, plot and stem describe the function.
13.   What is the function of built in function and subplot?
14.   What is linear convolution?
15.   Explain how convolution syntax built in function works.
16.   How to calculate the beginning and end of the sequence for the two sided controlled output?
17.   What is the total output length of linear convolution sum.
18.   What is an LTI system?
19.   Describe impulse response of a function.
20.  What is the difference between convolution and filter?
21.   Where to use command filter or impz, and what is the difference between these two?
22.  What is the use o function command ‘deconv’?
23.  What is the difference between linear and circular convolution?
24.  What do you mean by statement subplot (3,3,1).
25.   What do you mean by command “mod” and where it is used?
26.  What do you mean by Autocorrelation and Crosscorrelation sequences?
27.  What is the difference between Autocorrelatio and Crsscorrelation.
28.  List all the properties of autocorrelation and Crosscorrelaion sequence.
29.  Where we use the inbuilt function ‘xcorr’ and what is the purpose of using this function?
30.  How to calculate output of DFT using MATLAB?
31.   What do you mean by filtic command, explain.
32.  How to calculate output length of the linear and circular convolution.
33.  What do you mean by built in function ‘fliplr’ and where we need to use this.
34.  What is steady state response?
35.   Which built in function is used to solve a given difference equation?
36.  Explain the concept of difference equation.
37.  Where DFT is used?
38.  What is the difference between DFT and IDFT?
39.  What do you mean by built in function ‘abs’ and where it is used?
40.  What do you mean by phase spectrum and magnitude spectrum/ give comparison.
41.   How to compute maximum length N for a circular convolution using DFT and IDFT.(what is command).
42.  Explain the statement-                        y=x1.*x2
43.  What is FIR and IIR filter define, and distinguish between these two.
44.  What is filter?
45.   What is window method? How you will design an FIR filter using window method.
46.  What are low-pass and band-pass filter and what is the difference between these two?
47.  Explain the command – N=ceil(6.6*pi/tb)
48.  Write down commonly used window function characteristics.
49.  What is the matlab command for Hamming window? Explain.
50.   What do you mea by cut-off frequency?
51.   What do you mean by command butter, cheby1?
52.   Explain the command in detail- [N,wc]=buttord(2*fp/fs,2*fstp/fs,rp,As)
53.   What is CCS? Explain in detail to execute a program using CCS.
54.   Why do we need of CCS?
55.   How to execute a program using ‘dsk’ and ‘simulator’?
56.   Which IC is used in CCS? Explain the dsk, dsp kit.
57.   What do you mean by noise?
58.   Explain the program for linear convolution for your given sequence.
59.   Why we are using command ‘float’ in CCS programs.
60.  Where we use ‘float’ and where we use ‘int’?
61.   Explain the command- i=(n-k)%N
62.  Explain the entire CCS program in step by step of execution.