Digital Signal Processing Reference
In-Depth Information
% This finds the fourier coefficents of the
% given periodic signal 'x'
% in dir d:\matlab\toolbox\rf\forier.m
Nx=length(x); frac=log(Nx)/log(2);
if ( (frac - fix(frac))
>
0 ) m=fix(frac)+1; Nx=2^m; end;
A=fftshift(fft(x,Nx));
n=round(length(A)/2);
a=real(A)/n; b=-imag(A)/n;
% A=fft(x); n=round(length(A)/2);
% a=(real(A(1:n)))/n; b=-(imag(A(1:n)))/n;
f=linspace(-0.5,0.5,length(A)); f=f/delt;
clear A;
return
A.7.8 Program spk
%Digital Signal Processing:A Practitioner's Approach
%Dr.Kaluri Venkata Ranga Rao, kaluri@ieee.org
function [sx,f]=spk(x,delt)
% usage function [sx,f]=spk(x,delt);
% This finds the spectrum of the given
% vector x
% returns 'sx' spectrum and 'f' the frequency
% in dir e:\matlab\toolbox\rf\spk.m
n=length(x);
frac=log(n)/log(2);
if ( (frac - fix(frac))
0)
m=fix(frac)+1; N=2^m;
else
>
N=n;
end;
% w=hamming(n);
% x1=w.*x';
sxtemp=fft(x,N); f=linspace(0,0.5,N/2);
f=f/delt;
sx=(abs(sxtemp(1:N/2)))/(n/2);
return
A.7.9 Program pdf_y
%Digital Signal Processing:A Practitioner's Approach
%Dr.Kaluri Venkata Ranga Rao, kaluri@ieee.org
Search WWH ::




Custom Search