Digital Signal Processing Reference
In-Depth Information
A.7.4 Program rbn_sig
%Digital Signal Processing:A Practitioner's Approach
%Dr.Kaluri Venkata Ranga Rao, kaluri@ieee.org
%This program needs rbn_sig.m, expand.m
function yy=rbn_sig(N,x)
% generates a random binary telegraph signal
%with+1or0
% where N = pulse width (samples)
% and x is the binary sequence with +1 and -1
% ( bi-polar is a must)
% x=sign(randn( [1 n]));
% usage function yy=rbn_sig(N,x)
y=expand(x,N);
clear x;
k=find( y
0);
j=diff(k); i=find (j == N);
khat=k(i+1);
k=find( y
>
0);
j=diff(k); i=find (j == N);
khat_n=k(i+1);
y(khat)=y(khat)*0;
y(khat_n)=y(khat_n)*0;
b=1; a=[1 -1];
subplot(211)
plot(y);pause
yy=abs(filter(b,a,y));
subplot(212)
plot(yy)
clear y; clear k; clear khat_n;
clear khat; clear j; clear t;
clear a; clear b; clear i;
return
<
A.7.5 Program p2f1
%Digital Signal Processing:A Practitioner's Approach
%Dr.Kaluri Venkata Ranga Rao, kaluri@ieee.org
function [a,b,F]=p2f1(tow,f,A,n)
% function [a,b,F]=p2f (tow,f, A,n)
% converts a given pulse into
% fourier coefficients
% 'a' is a vector of cosine coefficeints
Search WWH ::




Custom Search