Digital Signal Processing Reference
In-Depth Information
function [X,Y]=pdf_y(y,n)
% function [X,Y]=pdf_y(y,n)
% Finds the pdf of y specifed
% by n bins and returns the
% range and pdf in X and Y
% resectively
% e:\matlab\toolbox\rf
l=length(y);
[N,X]=hist(y,n);
Y=N/l;
clear l;
return;
A.8 Some Useful Programs
These programs demonstarte some of the key concepts for understanding the
mathematics.
A.8.1 Program f 2_grad
%Digital Signal Processing:A Practitioner's Approach
%Dr.Kaluri Venkata Ranga Rao, kaluri@ieee.org
clear;close;
x=-10:0.2:10;
t=1:length(x);
min_x=8;
ref=ones(size(x))*min_x;
y=2*(x-min_x).*(x-min_x)+6;
xk=1;
yk=2*(xk-min_x)*(xk-min_x)+6;
gk=4*(xk-min_x);
step = 1;
for i=1:length(x)+20
t(i)=i;ref(i)=min_x;
xl(i)=0;xl_prv(i)=0;xr(i)=0;xr_prv(i)=0;
xk1=xk;yk1=yk;gk1=gk;
xk=xk - step*yk/gk;
yk=2*(xk-min_x)*(xk-min_x)+6+0.2*randn;
gk=4*(xk-min_x)+0.1*randn;
x1(i)=xk;
y1(i)=yk;
change_in_g=sign(gk1)-sign(gk);
if change_in_g == 2
Search WWH ::




Custom Search