Information about Digital Signal Processing and Control System under MATLAB Environment

A practical report on Digital Signal Processing and Control System under MATLAB Environment present in M.Tech 1st Semester during session 2013-14.

S.No. 1. 2. 3. 4. 5. 6. 7. Command Clc clear all close all zeros(N) zeros(M,N) ones(N) ones(M,N) 8. subplot(m,n,p) 9. stem(y) 10. 11. 12. stem(x,y) xlabel(‘text’) ylabel(‘text’) Input(‘How many assignments’) sum(A) prod(A) mean(A) length(A) inv(A) A’ rand(N) rand(N,M) magic(N) 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. max(A) min(A) Function Clear command window and homes the cursors Removes all variables, globals, functions and MEX links. Closes all the open figure windows. An N-by-N matrix of zeros. An M-by-N matrix of zeros. An N-by-N matrix of ones. An M-by-N matrix of ones. Breaks the Figure window into an m-by-n matrix of small axes, selects the p-th axes for the current plot, and returns the axis handle. Plots the data sequence y as stems from the x axis terminated with circles for the data value. If y is a matrix then each column is plotted as a separate series. Plots the data sequence y at the values specified in x. Adds text beside the x-axis on the current axis. Adds text beside the y-axis on the current axis. To get user defined value To find sum of matrix ‘A’ column wise. To find product of ‘A’(column wise). Find mean of ‘A’. To find length of matrix ‘A’. To find inverse of matrix ‘A’ if possible. It gives transpose of matrix ‘A’. It generates N-N random matrix. It generates N-M random matrix. It generates N-N matrix whose sum of all rows and columns are equal. It shows largest element present in each column. It shows smallest element present in each column. 2|Page info4eee | MATLAB

1. Write a program to generate unit step signal. Program: n=input('enter lowest index= '); m=input('enter highest index= '); t=n:m; x=ones(1,m-n+1); stem(t,x); axis([n m 0 1.5]); title('Unit Step Signal') xlabel('Value of n') ylabel('Amplitude') Command Window: >> psj_unitstep enter lowest index= 7 enter highest index= 17 Figure Window: 3|Page info4eee | MATLAB

2. Write a program to generate ramp signal. Program: n=input('enter lowest index= '); m=input('enter highest index= '); t=n:m; x=0:m-n; stem(t,x); axis([n m 0 m-n+1]); title('Unit Ramp Signal') xlabel('Value of n') ylabel('Amplitude') Command Window: >> psj_unitramp enter lowest index= 7 enter highest index= 17 Figure Window: 4|Page info4eee | MATLAB

3. Write a program to generate unit impulse signal. Program: n=input('enter the value of impluse point= '); t=n-2:n+2; x=[zeros(1,2) ones(1,1) zeros(1,2)]; stem(t,x); axis([n-2 n+2 0 1.5]); title('Unit Impulse Signal') xlabel('Value of n') ylabel('Amplitude') Command Window: >> psj_unitimpulse enter the value of impluse point= 7 Figure Window: 5|Page info4eee | MATLAB

4. Write a program to find the convolution of two numbers. Program: x=input('Enter the value of x= '); h=input('Enter the value of h= '); lx=length(x); lh=length(h); z(1,1:lx+lh-1)=zeros; l=max(lx,lh); for i=1:l y(1,2*i-1)=x(1,i)*h(1,i); z(1,2*i-1)=z(1,2*i-1)+y(1,2*i-1); end for j=2:l for i=j:l y(1,2*i-j)=x(1,i)*h(1,i-j+1)+x(1,i-j+1)*h(1,i); z(1,2*i-j)=z(1,2*i-j)+y(1,2*i-j); end end disp('The Convolution of x & h is'); z Command Window: >> psj_convolution Enter the value of x= [2,-1,0,0,1,0,-1] Enter the value of h= [1,2,2,1,0,-1,0] The Convolution of x & h is z= 2 3 2 0 0 0 2 -1 -2 -2 0 1 0 6|Page info4eee | MATLAB

5. Write a program to generate cosine wave of different amplitude. Program: t=0:0.01:10; c1=0.5*cos(2*pi*t); c2=cos(4*pi*t); c3=(2/3)*cos(6*pi*t); c=1+c1+c2+c3; subplot(4,1,1),plot(t,c1); xlabel('time axis----->'),ylabel('Amplitude----->'); axis([0 10 -0.7 0.7]); title('0.5*cos(2*pi*t)') subplot(4,1,2),plot(t,c2); xlabel('time axis----->'),ylabel('Amplitude----->'); title('cos(4*pi*t)') axis([0 10 -1.2 1.2]); subplot(4,1,3),plot(t,c3); xlabel('time axis----->'),ylabel('Amplitude----->'); title('(2/3)*cos(6*pi*t)') subplot(4,1,4),plot(t,c); xlabel('time axis----->'),ylabel('Amplitude of c----->'); title('1+0.5*cos(2*pi*t)+cos(4*pi*t)+(2/3)*cos(6*pi*t)') Command Window: >> psj_cosine 7|Page info4eee | MATLAB

Figure Window: 8|Page info4eee | MATLAB

6. Inbuilt function for Fourier transform in MATLAB. S.No. Command FFT(X) 1. FFT(X,N) FFT(X,N,DIM) FFT2(X) 2. FFT2(X,MROWS,NCOLS) FFTN(X) 3. FFTN(X,SIZ) IFFT(X) IFFT(X,N) IFFT(X,N,DIM) 4. IFFT(..., 'symmetric') IFFT(..., 'nonsymmetric') IFFT2(F) IFFT2(F,MROWS,NCOLS) 5. IFFT2(..., 'symmetric') IFFT2(..., 'nonsymmetric') IFFTN(F) 6. IFFTN(F,SIZ) Function Discrete Fourier transform (DFT) of vector X. For matrices, the FFT operation is applied to each column. For N-D arrays, the FFT operation operates on the first non-singleton dimension. N-point FFT padded with zeros if X has less than N points and truncated if it has more. FFT operation across the dimension DIMs. Two-dimensional Fourier transform of matrix X. If X is a vector, the result will have the same orientation. Pads matrix X with zeros to size MROWS-byNCOLS before transforming. N-dimensional discrete Fourier transform of the N-D array X. If X is a vector, the output will have the same orientation. Pads X so that its size vector is SIZ before performing the transform. If any element of SIZ is smaller than the corresponding dimension of X, then X will be cropped in that dimension. Inverse discrete Fourier transform of X. N-point inverse transform. Inverse discrete Fourier transform of X across the dimension DIM. IFFT to treat X as conjugate symmetric along the active dimension. This option is useful when X is not exactly conjugate symmetric merely because of round-off error. IFFT to make no assumptions about the symmetry of X. Two-dimensional inverse Fourier transform of matrix F. If F is a vector, the result will have the same orientation. Pads matrix F with zeros to size MROWS-byNCOLS before transforming. IFFT2 to treat F as conjugate symmetric in two dimensions so that the output is purely real. This option is useful when F is not exactly conjugate symmetric merely because of round-off error. IFFT2 to make no assumptions about the symmetry of F. N-dimensional inverse discrete Fourier transform of the N-D array F. If F is a vector, the result will have the same orientation. Pads F so that its size vector is SIZ before performing the transform. If any element of SIZ is 9|Page info4eee | MATLAB

IFFTN(..., 'symmetric') IFFTN(..., 'nonsymmetric') 7. DFTMTX(N) CONJ(DFTMTX(N))/N S = SPECTROGRAM(X) S = SPECTROGRAM(X,WINDOW) 8. S= SPECTROGRAM(X,WINDOW,NOV ERLAP) S= SPECTROGRAM(X,WINDOW,NOV ERLAP,NFFT) S= SPECTROGRAM(X,WINDOW,NOV ERLAP,NFFT,Fs) [S,F,T] = SPECTROGRAM(...) [S,F,T] = smaller than the corresponding dimension of F, then F will be cropped in that dimension. IFFTN to treat F as multidimensionally conjugate symmetric so that the output is purely real. This option is useful when F is not exactly conjugate symmetric merely because of round-off error. IFFTN to make no assumptions about the symmetry of F. N-by-N complex matrix of values around the unitcircle whose inner product with a column vector of length N yields the discrete Fourier transform of the vector. If X is a column vector of length N, then DFTMTX(N)*X yields the same result as FFT(X); however, FFT(X) is more efficient. The inverse discrete Fourier transform matrix. Spectrogram of the signal specified by vector X in the matrix S. By default, X is divided into eight segment with 50% overlap, each segment is windowed with a Hamming window. The number of frequency points used to calculate the discrete Fourier transforms is equal to the maximum of 256 or the next power of two greater than the length of each segment of X. If X cannot be divided exactly into eight segments, X will be truncated accordingly. when WINDOW is a vector, divides X into segments of length equal to the length of WINDOW, and then windows each segment with the vector specified in WINDOW. If WINDOW is an integer, X is divided into segments of length equal to that integer value, and a Hamming window of equal length is used. If WINDOW is not specified, the default is used. the number of samples each segment of X overlaps. NOVERLAP must be an integer smaller than WINDOW if WINDOW is an integer. NOVERLAP must be an integer smaller than the length of WINDOW if WINDOW is a vector. If NOVERLAP is not specified, the default value is used to obtain a 50% overlap. specifies the number of frequency points used to calculate the discrete Fourier transforms. If NFFT is not specified, the default NFFT is used. Fs is the sampling frequency specified in Hz. If Fs is specified as empty, it defaults to 1 Hz. If it is not specified, normalized frequency is used. a vector of frequencies F and a vector of times T at which the spectrogram is computed. F has length equal to the number of rows of S. T has length k and its value corresponds to the center of each segment. where F is a vector of frequencies in Hz computes 10 | P a g e info4eee | MATLAB

SPECTROGRAM(X,WINDOW,NOV ERLAP,F,Fs) [S,F,T,P] = SPECTROGRAM(...) SPECTROGRAM(...) 9. [X,T] = INSTDFFT(XHAT,LOWB,UPPB) 10 [XHAT,OMEGA] = NSTDFFT(X,LOWB,UPPB) the spectrogram at those frequencies using the Goertzel algorithm. The specified frequencies in F are rounded to the nearest DFT bin commensurate with the signal's resolution. P is a matrix representing the Power Spectral Density (PSD) of each segment. For real signals, SPECTROGRAM returns the one-sided modified periodogram estimate of the PSD of each segment; for complex signals and in the case when a vector of frequencies is specified, it returns the two-sided PSD. The PSD estimate for each segment on a surface in the current figure with no output arguments. It uses SURF(f,t,10*log10(abs(P)) where P is the fourth output argument. A trailing input string, FREQLOCATION, controls where MATLAB displays the frequency axis. This string can be either 'xaxis' or 'yaxis'. Setting this FREQLOCATION to 'yaxis' displays frequency on the y-axis and time on the x-axis. The default is 'xaxis' which displays the frequency on the x-axis. If FREQLOCATION is specified when output arguments are requested, it is ignored. the inverse nonstandard FFT of XHAT, on a powerof-2 regular grid (non necessarily integers) on the interval [LOWB,UPPB]. Output arguments are X the recovered signal computed on the time interval T given by T = LOWB + [0:n-1]*(UPPB-LOWB)/n, where n is the length of XHAT. Outputs are vectors of length n. The length of XHAT must be a power of 2. a nonstandard FFT of signal X sampled on a powerof-2 regular grid (non necessarily integers) on the interval [LOWB,UPPB]. Output arguments are XHAT the shifted FFT of computed on the interval OMEGA given by OMEGA = [-n:2:n-2]/(2*(UPPBLOWB)) where n is the length of X. Outputs are vectors of length n. Length of X must be a power of 2. 11 | P a g e info4eee | MATLAB

7. Write a program to find the Fourier transform of cosine function. Program: t=0:0.01:10; x=cos(2*pi*t); y=fft(x); z=ifft(y); subplot(3,1,1); plot(x); title('Cosine Wave') subplot(3,1,2); plot(y); title('FFT of Cosine Wave') subplot(3,1,3); plot(z); title('IFFT') Command Window: >> psj_fourier Figure Window: 12 | P a g e info4eee | MATLAB

8. Write a program to find the DFT of given sequence. Program: h=input('enter sequence= '); N=input('enter N='); n=length(h); x=[h,zeros(1,N-n)]; y=zeros(N,1); for k=1:N, for n=1:N, y(k)=y(k)+x(n)*exp(-i*2*pi*(k-1)*(n-1)/N); end end disp('DFT of x='); y Command Window: >> psj_dft enter sequence= [1 2 4 8 16 32 64 128] enter N=8 DFT of x= y= 1.0e+002 * 2.5500 0.4864 + 1.6607i -0.5100 + 1.0200i -0.7864 + 0.4607i -0.8500 - 0.0000i -0.7864 - 0.4607i -0.5100 - 1.0200i 0.4864 - 1.6607i 13 | P a g e info4eee | MATLAB

9. Write a program to find the IDFT of given sequence. Program: h=input('enter sequence = '); N=input('enter N = '); n=length(x); x=[h,zeros(1,N-n)]; y=zeros(N,1); for n=1:N, for k=1:N, y(k)=y(k)+(1/N)*x(n)*exp(i*2*pi*(k-1)*(n-1)/N); end end disp('IDFT of Sequence = '); y Command Window: >> psj_idft enter sequence = [36 -4+9.656i -4+4i -4+1.656i -4 -4-1.656i -4-4i -4-9.656i] enter N = 8 IDFT of Sequence = y= 1.0000 2.0003 + 0.0000i 3.0000 + 0.0000i 4.0003 5.0000 - 0.0000i 5.9997 - 0.0000i 7.0000 + 0.0000i 7.9997 - 0.0000i 14 | P a g e info4eee | MATLAB

10. Write a program to find the DFT of given sequence using matrix. Program: x=input('Enter the sequence = '); n=length(x); w=dftmtx(n); y=[w*x']; w; disp('DFT of Sequence'); y Command Window: >> psj_dftumtx Enter the sequence = [1 2 3 4 4 3 2 1] DFT of Sequence y= 20.0000 -5.8284 - 2.4142i 0 -0.1716 - 0.4142i 0 -0.1716 + 0.4142i 0 -5.8284 + 2.4142 15 | P a g e info4eee | MATLAB

11. Write a program to find the IDFT using matrix. Program: x=input('enter the sequence = '); n=length(x); w=conj(dftmtx(n))/n; y=[inv(w)*x']/n; w; disp('IDFT of Sequence'); y Command Window: >> psj_idftumtx enter the sequence = [36 -4+9.656i -4+4i -4+1.656i -4 -4-1.656i -4-4i -49.656i] IDFT of Sequence y= 1.0000 + 0.0000i 2.0003 + 0.0000i 3.0000 - 0.0000i 4.0003 - 0.0000i 5.0000 + 0.0000i 5.9997 + 0.0000i 7.0000 - 0.0000i 7.9997 + 0.0000i 16 | P a g e info4eee | MATLAB

12. Write a program to generate DFT Matrix without using direct command. Program: N=input('Enter the value of N = '); x=zeros(N,N); for j=1:N, n=N*(j-1); for k=1:N, x(k+n)=exp(-i*2*pi*(j-1)*(k-1)/N); end end disp('Resultant matrix '); x Command Window: >> psj_dftmtx Enter the value of N = 4 Resultant matrix x= 1.0000 1.0000 1.0000 1.0000 1.0000 0.0000 - 1.0000i -1.0000 - 0.0000i -0.0000 + 1.0000i 1.0000 -1.0000 - 0.0000i 1.0000 + 0.0000i -1.0000 - 0.0000i 1.0000 -0.0000 + 1.0000i -1.0000 - 0.0000i 0.0000 - 1.0000i 17 | P a g e info4eee | MATLAB

13. Write a program to find the step response and impulse response of transfer function. Program: sys=tf([8 18 31],[1 6 14 24]) subplot(2,1,1) step(sys) subplot(2,1,2) impulse(sys) Command Window: >> psj_sni Transfer function: 8 s^2 + 18 s + 31 ----------------------s^3 + 6 s^2 + 14 s + 24 Figure Window: 18 | P a g e info4eee | MATLAB

14. Design a system to convert Fahrenheit to degree Celsius. Setup: 19 | P a g e info4eee | MATLAB

15. Design a system for torque converter. Setup: -------------------------------------A Group -------------------------------------- 20 | P a g e info4eee | MATLAB

Presentación que realice en el Evento Nacional de Gobierno Abierto, realizado los ...

In this presentation we will describe our experience developing with a highly dyna...

Presentation to the LITA Forum 7th November 2014 Albuquerque, NM

Un recorrido por los cambios que nos generará el wearabletech en el futuro

Um paralelo entre as novidades & mercado em Wearable Computing e Tecnologias Assis...

Microsoft finally joins the smartwatch and fitness tracker game by introducing the...

... and Control System under MATLAB Environment ... SIGNAL PROCESSING & CONTROL SYSTEM Under ... Systems and Digital Signal Processing ...

Read more

It offers tight integration with the rest of the MATLAB environment ... Signal generator blocks of Simulink, ... systems to the Simulink environment, ...

Read more

Signal Processing Toolbox™ provides ... Sound System using MATLAB Accelerate Signal Processing and Communications Algorithms Digital Filter Design with ...

Read more

... FIX32/iFIX and MATLAB/Simulink environments. M2F in. ... Systems; Digital Signal Processing; ... , Digital Signal Processing, Process Control and ...

Read more

What Is Digital Signal Processing? ... 1.1.1 Digital Signal Processing under the Pyramids ... background in signals and systems, ...

Read more

Available Projects: Signal Processing. ... Adapting EEG signals to control mobile ... decisions based on the sensed environment. These systems ...

Read more

MATLAB Licensed Toolboxes. ... Control System: ... Analog and digital signal processing tools:

Read more

Digital Signal Processing from École Polytechnique Fédérale de Lausanne. ... Digital Communication Systems: ... Familiarity with Matlab ...

Read more

The online version of Digital Signal Processing by Li Tan and Jean ... Digital Signals and Systems ... Introduction to the MATLAB Environment

Read more

## Add a comment