diff options
Diffstat (limited to '22')
-rwxr-xr-x | 22/CH10/EX10.10/ch10ex10.sce | 13 | ||||
-rwxr-xr-x | 22/CH3/EX3.8/ch3ex8.sce | 36 | ||||
-rwxr-xr-x | 22/CH3/EX3.9/ch3ex9.sce | 30 | ||||
-rwxr-xr-x | 22/CH4/EX4.27/ch4ex27.sce | 21 | ||||
-rwxr-xr-x | 22/CH5/EX5.10/ch5ex10.sce | 19 | ||||
-rwxr-xr-x | 22/CH8/EX8.9/ch8ex9.sce | 54 |
6 files changed, 88 insertions, 85 deletions
diff --git a/22/CH10/EX10.10/ch10ex10.sce b/22/CH10/EX10.10/ch10ex10.sce index ef4197be5..4c7c0cbdd 100755 --- a/22/CH10/EX10.10/ch10ex10.sce +++ b/22/CH10/EX10.10/ch10ex10.sce @@ -1,7 +1,8 @@ -A=[0 1;-2 -3];
-[V,lambda]=spec(A);
-B=[1;2];
-Bhat=P*B
-disp(P,"P=")
-disp(Bhat,"B^=")
+A=[0 1;-2 -3]; + P = [2 1; 1 1] +[V,lambda]=spec(A); +B=[1;2]; +Bhat=P*B +disp(P,"P=") +disp(Bhat,"B^=") disp(lambda,"lambda=")
\ No newline at end of file diff --git a/22/CH3/EX3.8/ch3ex8.sce b/22/CH3/EX3.8/ch3ex8.sce index cf7361f87..22e02d201 100755 --- a/22/CH3/EX3.8/ch3ex8.sce +++ b/22/CH3/EX3.8/ch3ex8.sce @@ -1,18 +1,18 @@ -//signals and systems
-//time domain analysis of discreet time systems
-//iterative solution
-clear;
-close;
-clc;
-n=(-1:10)';
-y=[16;0;zeros(length(n)-2,1)];
-x=[0;0;n(3:length(n))];
-for k=1:length(n)-1
- y(k+1)=0.5*y(k)+x(k+1);
-end;
-clf;
-size(y)
-size(n)
-plot2d3(n,y);
-plot(n,y,'r.')
-disp([msprintf([n,y])]);
+//signals and systems +//time domain analysis of discreet time systems +//iterative solution +clear; +close; +clc; +n=(-1:10)'; +y=[16;0;zeros(length(n)-2,1)]; +x=[0;0;n(3:length(n))]; +for k=1:length(n)-1 + y(k+1)=0.5*y(k)+x(k+1); +end; +clf; +size(y) +size(n) +plot2d3(n,y); +plot(n,y,'r.') +disp([msprintf('%d %d\n',[n,y])]);
\ No newline at end of file diff --git a/22/CH3/EX3.9/ch3ex9.sce b/22/CH3/EX3.9/ch3ex9.sce index b651f07e0..3acc5cb3e 100755 --- a/22/CH3/EX3.9/ch3ex9.sce +++ b/22/CH3/EX3.9/ch3ex9.sce @@ -1,15 +1,15 @@ -//signals and systems
-//time domain analysis of discreet time systems
-//iterative solution
-clear;
-close;
-clc;
-n=(-2:10)';
-y=[1;2;zeros(length(n)-2,1)];
-x=[0;0;n(3:length(n))];
-for k=1:length(n)-2
- y(k+2)=y(k+1)-0.24*y(k)+x(k+2)-2*x(k+1);
-end;
-clf;
-plot2d3(n,y);
-disp([msprintf([n,y])]);
+//signals and systems +//time domain analysis of discreet time systems +//iterative solution +clear; +close; +clc; +n=(-2:10)'; +y=[1;2;zeros(length(n)-2,1)]; +x=[0;0;n(3:length(n))]; +for k=1:length(n)-2 + y(k+2)=y(k+1)-0.24*y(k)+x(k+2)-2*x(k+1); +end; +clf; +plot2d3(n,y); +disp([msprintf('%d %d\n',[n,y])]);
\ No newline at end of file diff --git a/22/CH4/EX4.27/ch4ex27.sce b/22/CH4/EX4.27/ch4ex27.sce index 0389caa79..85993f0a8 100755 --- a/22/CH4/EX4.27/ch4ex27.sce +++ b/22/CH4/EX4.27/ch4ex27.sce @@ -1,10 +1,11 @@ -omega_0=2*%pi*60; theta = [60 80 87]*(%pi/180);
-omega = (0:0.5:1000)'; mag = zeros(3,length(omega));
-s=poly(0,'s')
-for m =1:length(theta)
- H=syslin('c',((s^2+omega_0^2)/(s^2+2*omega_0*cos(theta(m))*s +omega_0^2)));
- bode(H,10,100);
-end
-f=omega/((2*%pi))plot(f,mag(1,:),'k-',f mag(2,:),'k--',f,mag(3,:),'k-.');
-xlabel('f[hz]'); ylabel('|H(j2/pi f)|');
-legend('\theta=60^\circ','\theta = 80^\circ','\theta = 87^\circ',0)
\ No newline at end of file +omega_0=2*%pi*60; theta = [60 80 87]*(%pi/180); +omega = (0:0.5:1000)'; mag = zeros(3,length(omega)); +s=poly(0,'s') +for m =1:length(theta) + H=syslin('c',((s^2+omega_0^2)/(s^2+2*omega_0*cos(theta(m))*s +omega_0^2))); + bode(H,10,100); +end +f=omega/((2*%pi)); +plot(f,mag(1,:)','k-',f,mag(2,:)','k--',f,mag(3,:)','k-.'); +xlabel('f[hz]'); ylabel('|H(j2/pi f)|'); +legend('\theta=60^\circ','\theta = 80^\circ','\theta = 87^\circ',1)
\ No newline at end of file diff --git a/22/CH5/EX5.10/ch5ex10.sce b/22/CH5/EX5.10/ch5ex10.sce index 648263714..ebc84e50d 100755 --- a/22/CH5/EX5.10/ch5ex10.sce +++ b/22/CH5/EX5.10/ch5ex10.sce @@ -1,10 +1,11 @@ -omega= linspace(-%pi,%pi,106);
-H= syslin('c',(s/(s-0.8)));
-H_omega= squeeze(calfrq(H,0.01,10));
-size(H_omega)
-subplot(2,1,1); plot2d(omega, abs(H_omega));
-//xlabel('\omega');
-//ylabel('|H[e^{j\omega}]|');
-subplot(2,1,2); plot2d(omega,atan(imag(H_omega),real(H_omega))*180/%pi);
-//xlabel('\omega');
+omega= linspace(-%pi,%pi,106); +s = %s; +H= syslin('c',(s/(s-0.8))); +H_omega= squeeze(calfrq(H,0.01,10)); +size(H_omega) +subplot(2,1,1); plot2d(omega, abs(H_omega)); +//xlabel('\omega'); +//ylabel('|H[e^{j\omega}]|'); +subplot(2,1,2); plot2d(omega,atan(imag(H_omega),real(H_omega))*180/%pi); +//xlabel('\omega'); //ylabel('\angle H[e^{j \omega}] [deg]');
\ No newline at end of file diff --git a/22/CH8/EX8.9/ch8ex9.sce b/22/CH8/EX8.9/ch8ex9.sce index 161d190e9..f4b24a2d5 100755 --- a/22/CH8/EX8.9/ch8ex9.sce +++ b/22/CH8/EX8.9/ch8ex9.sce @@ -1,27 +1,27 @@ -//signals and systems
-//sampling:the bridge from continuous to discrete
-//DFT to compute the fourier transform of 8rect(t)
-T_0 = 4;
-N_0 = 32;
-T = T_0/N_0;
-x_n = [ones(1,4) 0.5 zeros(1,23) 0.5 ones(1,3)]';
-size(x_n)
-x_r = fft(x_n);r = (-N_0/2:(N_0/2)-1)';
-omega_r = ((r*2)*%pi)/T_0;
-size(omega_r)
-size(omega)
-omega = linspace(-%pi/T,%pi/T,4097);
-X = 8*(sinc(omega/2));
-size(X)
-figure(1);
-subplot(2,1,1);
-plot(omega,abs(X),"k");
-plot(omega_r,fftshift(abs(x_r)),"ko")
-xtitle("angle of X(omega) for true FT and DFT");
-a=gca();
-subplot(2,1,2);
-a = gca();
-a.y_location ="origin";
-a.x_location ="origin";
-plot(omega,atan(imag(X),real(X)),"k",omega_r,fftshift(atan(imag(x_r),real(x_r))),'r.');
-xtitle("angle of X(omega) for true FT and DFT");
+//signals and systems +//sampling:the bridge from continuous to discrete +//DFT to compute the fourier transform of 8rect(t) +T_0 = 4; +N_0 = 32; +T = T_0/N_0; +x_n = [ones(1,4) 0.5 zeros(1,23) 0.5 ones(1,3)]'; +size(x_n) +x_r = fft(x_n);r = (-N_0/2:(N_0/2)-1)'; +omega_r = ((r*2)*%pi)/T_0; +omega = linspace(-%pi/T,%pi/T,4097); +size(omega_r) +size(omega) +X = 8*(sinc(omega/2)); +size(X) +figure(1); +subplot(2,1,1); +plot(omega,abs(X),"k"); +plot(omega_r,fftshift(abs(x_r)),"ko") +xtitle("angle of X(omega) for true FT and DFT"); +a=gca(); +subplot(2,1,2); +a = gca(); +a.y_location ="origin"; +a.x_location ="origin"; +plot(omega,atan(imag(X),real(X)),"k",omega_r,fftshift(atan(imag(x_r),real(x_r))),'r.'); +xtitle("angle of X(omega) for true FT and DFT");
\ No newline at end of file |