IMPULSE RESPONSE
#1

Code:
#include <stdio.h>
#define Order     2
#define Len     10
float y[Len]={0,0,0},sum;
main()
{
                              int j,k;
     float a[Order+1]={1,-0.9};
                             float b[Order+1]={1};
     for(j=0;j<Len;j++)
       {
       sum=0;
       for(k=1;k<=Order;k++)
       {
           if((j-k)>=0)
           sum=sum+(a[k]*y[j-k]);
       }
       if(j<=Order)
       {
           y[j]=b[j]-sum;    
       }
       else
       {
           y[j]=-sum;
       }
       printf("Respose[%d] = %f\n",j,y[j]);
       }
}
PROCEDURE:
 Open Code Composer Studio, make sure the DSP kit is turned on.
 Use the Debug  Connect menu option to open a debug connection to the DSK board
 Start a new project using ‘Project-new ‘ pull down menu, save it in a
separate directory(C:\CCStudio_v3.1\myprojects) with name Impulse_response.pjt.
 Add the source files impulse_res.c
 to the project using ‘Projectadd files to project’ pull down menu.
 Add the linker command file hello.cmd .
(Path: C:\CCStudio_v3.1\tutorial\dsk6713\hello1\hello.cmd)
 Add the run time support library file rts6700.lib
(Path: C:\CCStudio_v3.1\c6000\cgtools\lib\rts6700.lib)
 Compile the program using the ‘Project-compile’ pull down menu or by
clicking the shortcut icon on the left side of program window.
 Build the program using the ‘Project-Build’ pull down menu or by
clicking the shortcut icon on the left side of program window.
 Load the program(Impulse_response.out) in program memory of DSP chip using the
‘File-load program’ pull down menu.
 Execute the program. Debugrun
Result: The result is displayed on the Debug window.
1. CLC Clear command window.
CLC clears the command window and homes the cursor.
2 .CLEAR Clear variables and functions from memory.
CLEAR removes all variables from the workspace.
3. CLOSE Close figure.
CLOSE, by itself, closes the current figure window.
CLOSE('name') closes the named window.
CLOSE ALL closes all the open figure windows.
CLOSE ALL HIDDEN closes hidden windows as well.
4. INPUT Prompt for user input.
R = INPUT('How many apples') gives the user the prompt in the text string and then waits for input from the keyboard.The input can be any MATLAB expression, which is evaluated, using the variables in the current workspace, and the result returned in R. If the user presses the return key without entering anything, INPUT returns an empty matrix.
R = INPUT('What is your name','s') gives the prompt in the text string and waits for character string input. The typed input is not evaluated; the characters are simply returned as a MATLAB string.

5. PLOT Linear plot.
PLOT(X,Y) plots vector Y versus vector X. If X or Y is a matrix, then the vector is plotted versus the rows or columns of the matrix, whichever line up. If X is a scalar and Y is a vector, length(Y) disconnected points are plotted.

PLOT(Y) plots the columns of Y versus their index. If Y is complex, PLOT(Y) is equivalent to PLOT(real(Y),imag(Y)). In all other uses of PLOT, the imaginary part is ignored.

Various line types, plot symbols and colors may be obtained with PLOT(X,Y,S) where S is a character string made from one element from any or all the following 3 columns:

b blue . point - solid
g green o circle : dotted
r red x x-mark -. dashdot
c cyan + plus -- dashed
m magenta * star
y yellow s square
k black d diamond
v triangle (down)
^ triangle (up)
< triangle (left)
> triangle (right)
p pentagram
6. STEM Discrete sequence or "stem" plot.
STEM(Y) plots the data sequence Y as stems from the x axis terminated with circles for the data value.
STEM(X,Y) plots the data sequence Y at the values specified in X.

7. BAR Bar graph.
BAR(X,Y) draws the columns of the M-by-N matrix Y as M groups of N vertical bars. The vector X must be monotonically increasing or decreasing.
BAR(Y) uses the default value of X=1: M. For vector inputs, BAR(X,Y) or BAR(Y) draws LENGTH(Y) bars.

8. SUBPLOT Create axes in tiled positions.
H = SUBPLOT(m,n,p), or SUBPLOT(mnp), 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. The axes are counted along the top row of the Figure window, then the second row, etc. For example,

SUBPLOT(2,1,1), PLOT(income)
SUBPLOT(2,1,2), PLOT(outgo)

9. XLABEL X-axis label.
XLABEL('text') adds text beside the X-axis on the current axis.

10. YLABEL Y-axis label.
YLABEL('text') adds text beside the Y-axis on the current axis.

11. TITLE Graph title.
TITLE('text') adds text at the top of the current axis.


12. AXIS Control axis scaling and appearance.
AXIS([XMIN XMAX YMIN YMAX]) sets scaling for the x- and y-axes on the current plot.

13.GRID Grid lines.
GRID ON adds major grid lines to the current axes.
GRID OFF removes major and minor grid lines from the current axes.

14. DISP Display array.
DISP(X) displays the array, without printing the array name. In all other ways it's the same as leaving the semicolon off an expression except that empty arrays don't display.
If X is a string, the text is displayed.

15. LENGTH Length of vector.
LENGTH(X) returns the length of vector X. It is equivalent to MAX(SIZE(X)) for non-empty arrays and 0 for empty ones.

16. MAX Largest component.
For vectors, MAX(X) is the largest element in X.For matrices, MAX(X) is a row vector containing the maximum element from each column. MAX(X,Y) returns an array the same size as X and Y with the largest elements taken from X or Y.

17. CONV Convolution and polynomial multiplication.
C = CONV(A, B) convolves vectors A and B. The resulting vector is length LENGTH(A)+LENGTH(B)-1. If A and B are vectors of polynomial coefficients, convolving them is equivalent to multiplying the two polynomials.

18. ERROR Display message and abort function.
ERROR('MSG') displays the text MSG and causes an error exit from an M-file to the keyboard. In this case, the message identifier for the error will default to the empty string. As a special case, if MSG is an empty string, no action is taken and ERROR returns without exiting from the M-file.
19. ZEROS Zeros array.
ZEROS(N) is an N-by-N matrix of zeros.
ZEROS(M,N) or ZEROS([M,N]) is an M-by-N matrix of zeros.
ZEROS(M,N,P,...) or ZEROS([M N P ...]) is an M-by-N-by-P-by-...
array of zeros.
ZEROS(SIZE(A)) is the same size as A and all zeros.
20. ONES Ones array.
ONES(N) is an N-by-N matrix of ones.
ONES(M,N) or ONES([M,N]) is an M-by-N matrix of ones.
ONES(M,N,P,...) or ONES([M N P ...]) is an M-by-N-by-P-by-...
array of ones.
ONES(SIZE(A)) is the same size as A and all ones.
21. XCORR Cross-correlation function estimates.
C = XCORR(A,B), where A and B are length M vectors (M>1), returns the length 2*M-1 cross-correlation sequence C. If A and B are of different length, the shortest one is zero-padded. C will be a row vector if A is a row vector, and a column vector if A is a column vector.XCORR(A), when A is a vector, is the auto-correlation sequence.
XCORR(A), when A is an M-by-N matrix, is a large matrix with 2*M-1 rows whose N^2 columns contain the cross-correlation sequences for all combinations of the columns of A.
22. SUM Sum of elements. For vectors, SUM(X) is the sum of the elements of X. For matrices, SUM(X) is a row vector with the sum over each column
23. CEIL Round towards plus infinity.
CEIL(X) rounds the elements of X to the nearest integers
towards infinity.
24. FLIPLR Flip matrix in left/right direction.
FLIPLR(X) returns X with row preserved and columns flipped in the left/right direction.
X = 1 2 3 becomes 3 2 1
4 5 6 6 5 4
25. IMPZ Impulse response of digital filter
[H,T] = IMPZ(B,A) computes the impulse response of the filter B/A choosing the number of samples for you, and returns the response in column vector H and a vector of times (or sample intervals) in T (T = [0 1 2 ...]').
[H,T] = IMPZ(B,A,N) computes N samples of the impulse response. If N is a vector of integers, the impulse response is computed only at those integer values (0 is the origin)
26. FILTER One-dimensional digital filter.
Y = FILTER(B,A,X) filters the data in vector X with the filter described by vectors A and B to create the filtered data Y. The filter is a "Direct Form II Transposed" implementation of the standard difference equation:
a(1)*y(n) = b(1)*x(n) + b(2)*x(n-1) + ... + b(nb+1)*x(n-nb)
- a(2)*y(n-1) - ... - a(na+1)*y(n-na)
If a(1) is not equal to 1, FILTER normalizes the filter coefficients by a(1).
[Y,Zf] = FILTER(B,A,X,Zi) gives access to initial and final conditions, Zi and Zf, of the delays. Zi is a vector of length MAX(LENGTH(A),LENGTH(B))-1, or an array with the leading dimension of size MAX(LENGTH(A),LENGTH(B))-1 and with remaining dimensions matching those of X.
27. FFT Discrete Fourier transform.
FFT(X) is the discrete Fourier transform (DFT) of vector X.
28. IFFT Inverse discrete Fourier transform.
IFFT(X) is the inverse discrete Fourier transform of X.
29. ABS Absolute value.
ABS(X) is the absolute value of the elements of X. When X is complex, ABS(X) is the complex modulus (magnitude) of the elements of X.
30.ANGLE Phase angle.
ANGLE(H) returns the phase angles, in radians, of a matrix with complex elements.
31. BUTTORD Butterworth filter order selection.
[N, Wn] = BUTTORD(Wp, Ws, Rp, Rs) returns the order N of the lowest order digital Butterworth filter that loses no more than Rp dB in the passband and has at least Rs dB of attenuation in the stopband.
Wp and Ws are the passband and stopband edge frequencies, normalized from 0 to 1 (where 1 corresponds to pi radians/sample). For example,
Lowpass: Wp = .1, Ws = .2
Highpass: Wp = .2, Ws = .1
Bandpass: Wp = [.2 .7], Ws = [.1 .8]
Bandstop: Wp = [.1 .8], Ws = [.2 .7]
BUTTORD also returns Wn, the Butterworth natural frequency (or, the "3 dB frequency") to use with BUTTER to achieve the specifications.
[N, Wn] = BUTTORD(Wp, Ws, Rp, Rs, 's') does the computation for an analog filter, in which case Wp and Ws are in radians/second.
When Rp is chosen as 3 dB, the Wn in BUTTER is equal to Wp in BUTTORD.
32. BUTTER Butterworth digital and analog filter design.
[B,A] = BUTTER(N,Wn) designs an Nth order lowpass digital Butterworth filter and returns the filter coefficients in length N+1 vectors B (numerator) and A (denominator). The coefficients are listed in descending powers of z. The cutoff frequency Wn must be 0.0 < Wn < 1.0, with 1.0 corresponding to half the sample rate.
[B,A] = BUTTER(N,Wn,'high') designs a highpass filter.
[B,A] = BUTTER(N,Wn,'stop') is a bandstop filter if Wn = [W1 W2].
BUTTER(N,Wn,'s'), BUTTER(N,Wn,'high','s') and BUTTER(N,Wn,'stop','s') design analog Butterworth filters. In this case, Wn is in [rad/s] and it can be greater than 1.0.
33. BILINEAR Bilinear transformation with optional frequency prewarping.
[NUMd,DENd] = BILINEAR(NUM,DEN,Fs), where NUM and DEN are row vectors containing numerator and denominator transfer function coefficients, NUM(s)/DEN(s), in descending powers of s, transforms to z-transform coefficients NUMd(z)/DENd(z).
34. FREQZ Digital filter frequency response.
[H,W] = FREQZ(B,A,N) returns the N-point complex frequency response vector H and the N-point frequency vector W in radians/sample of the filter:
jw -jw -jmw
jw B(e) b(1) + b(2)e + .... + b(m+1)e
H(e) = ---- = ------------------------------------
jw -jw -jnw
A(e) a(1) + a(2)e + .... + a(n+1)e
given numerator and denominator coefficients in vectors B and A. The frequency response is evaluated at N points equally spaced around the upper half of the unit circle. If N isn't specified, it defaults to 512.

[H,F] = FREQZ(B,A,N,Fs) and [H,F] = FREQZ(B,A,N,'whole',Fs) return frequency vector F (in Hz), where Fs is the sampling frequency (in Hz).
Reply

Important Note..!

If you are not satisfied with above reply ,..Please

ASK HERE

So that we will collect data for you and will made reply to the request....OR try below "QUICK REPLY" box to add a reply to this page
Popular Searches: find impulse response of given system, matlab program to determine impulse response of system ppt, cocoa butter, plot for salethan, impulse response of a system pdf, finite impulse response, how to plot a,

[-]
Quick Reply
Message
Type your reply to this message here.

Image Verification
Please enter the text contained within the image into the text box below it. This process is used to prevent automated spam bots.
Image Verification
(case insensitive)

Possibly Related Threads...
Thread Author Replies Views Last Post
  FINITE IMPULSE RESPONSE FILTER (FIR) seminar class 0 1,277 06-05-2011, 03:57 PM
Last Post: seminar class
  IMPULSE RESPONSE OF THE GIVEN SYSTEM seminar class 0 1,396 06-05-2011, 03:27 PM
Last Post: seminar class

Forum Jump: