Digital Signal Processing Reference
In-Depth Information
clear;
kmax=5000;bins=100;order=5;
k=1:kmax; g=9.81;
mu_v=50; sig_v=0.2;
mu_th=pi/3; sig_th=pi/30;
temp=randn(size(k));
v=temp*sig_v; v=v+mu_v;
temp=randn(size(k));
th=temp*sig_th; th=th+mu_th;
d=v.*v.*sin(2*th)/g;
[N,X]=hist(d,bins); pdf=N/kmax;
[P,S]=polyfit(X,pdf,order);
pdf_hat=polyval(P,X);
subplot(221)
plot(k,v);grid;title(' A ');ylabel(' V in m/sec ');
subplot(222)
plot(k,th*180/pi);grid;title(' B ');ylabel(' Theta Deg ');
subplot(212)
plot(X,pdf,'.',X,pdf_hat);grid;title('C');ylabel('Probability');
A.2.5 Program f 2_89
%Digital Signal Processing:A Practitioner's Approach
%Dr.Kaluri Venkata Ranga Rao, kaluri@ieee.org
%Generates figure 2.14
%This program needs pdf_y.m
clear;close;
delta=0.1;f=100;
omega=2*pi*f;
b=omega*omega;
a=[1 2*delta*omega omega*omega];
Ts=1/(10*f);
sysc=tf(b,a)
sysd=c2d(sysc,Ts,'tustin');
[b1 a1]=tfdata(sysd,'v');
plot(impulse(sysd));grid;
a=0.1;b=0.8;
for i=1:6000
u(i)=weibrnd(a,b);
end
z=filter(b1,a1,u);
[x,y]=pdf_y(u,30);
[x1,y1]=pdf_y(z,20);
Search WWH ::




Custom Search