Digital Signal Processing Reference
In-Depth Information
% 'b' is a vector of sine coefficents.
% 'F' is a vector giving the corresponding freq.
% 'tow' is the pulse width.
% 'f' is the frequency or the reciprocal of time-period.
% 'A' is the amplitude of the pulse.
% 'n' desired number of coefficients.
N=fix(n/2);
t=-N:1:N-1;
tc=pi*f*tow; F=t*f;
ta=A/pi;
a=ta*(sin(2*tc*t))./t;
b=2*ta*((sin(tc*t)).^2)./t;
%plot(b);pause;
i=find(isnan(a));
v1=a(i+1); v2=a(i-1);
a(i)=(v1+v2)/2;
i=find(isnan(b));
v1=b(i+1); v2=b(i-1);
b(i)=(v1+v2)/2;
clear v1; clear v2; clear i;
return
A.7.6 Program pulse
%Digital Signal Processing:A Practitioner's Approach
%Dr.Kaluri Venkata Ranga Rao, kaluri@ieee.org
%This program needs pulse.m
function [y,delt]=pulse(tow,T,n);
% function [y,delt]=pulse(tow,T,n);
% generates a pulse of pulse width
% 'tow' sec and time period of 'T' sec
% of 'n' samples in the array 'y'
delt=T/n; n1=round(tow/delt);
t1=1:n1; y=1:n; y=0*y;
y(1:n1)=ones(size(t1));
return
A.7.7 Program forier
%Digital Signal Processing:A Practitioner's Approach
%Dr.Kaluri Venkata Ranga Rao , kaluri@ieee.org
function [f,a,b]=forier(x,delt);
% usage function [f,a,b]=forier(x,delt);
Search WWH ::




Custom Search