APPENDIX

MATLAB and C Programs

We consider this to be the most important part of the book. Each program was tested and has a comment statement to say which figures it generates; this is to put the reader at ease while running the program. Try to play with the programs by manipulating various parameters to see their effects. We have repeated the relevant chapter summary at the start of Section A.1 to A.6.

A.1 Chapter 1 MATLAB Programs

In this chapter we discussed the types of signals and the transformations a signal goes through before it is in a form suitable for input to a DSP processor. We introduced some common transforms, time and frequency domain interchanges, and the concepts of windowing, sampling and quantisation plus a model of an A/D converter. The last few sections give a flavour of DSP.

A.1.1 Program f1_1234

%Digital Signal Processing:A Practitioner's Approach
%Dr.Kaluri Venkata Ranga Rao, kaluri@ieee.org
%Generates figures 1.1, 1.2
% Generations of Signals for 1st Chapter
% 25th July 2003
clear;clf;
% Narrow Band Signal
fc=0.3; wn_upper=fc+fc*0.01; wn_lower=fc-fc*0.01;
wn=[wn_lower wn_upper];
[b,a]=butter(2,wn);
t=1:1000; u=randn(size(t));
 y=filter(b,a,u); [sx,f]=spk(y,1); subplot(221);plot(t,y);grid; title(‘A’) xlabel(‘ Time ’) subplot(222);plot(f,sx);grid; title(‘B’) xlabel(‘ Frequency ’) %title (‘Fig 1.1’); pause; %print –depsc f1_1; %title(‘Fig 1.2’); %print –depsc f1_2; pause; % Broad band signal fc=0.6; wn_upper=fc+fc*0.1; wn_lower=fc-fc*0.1; wn=[wn_lower ...

Get Digital Signal Processing: A Practitioner's Approach now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.