📄 ep7_1.m
字号:
%%%%%%%%%%%% Exploratory problem 7.1 %%%%%%%%%%%%
% Discrete-Time Control Problems using %
% MATLAB and the Control System Toolbox %
% by J.H. Chow, D.K. Frederick, & N.W. Chbat %
% Brooks/Cole Publishing Company %
% September 2002 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% RPI function
% M-file p_local.m
% feedback effect on drum sound
% to use file, enter p_local in MATLAB command window
% drum sound track recorded by Nick Chbat
% m file by Joe Chow
load local
fs = 16384 % sampling rate
t=[0:length(local)-1]'/fs;
figure(1), plot(t,local)
xlabel('Time (sec)')
ylabel('local')
title('Original drum beats')
sound(local,fs)
pause
%D = 2000; % delay in second is D/fs
% D = 2000 is too long, hear two distinct beats
%D = 500;
%a = 0.9; % attenuation -- great effect
%a = 0.7;
D = 200;
a = 0.9;
num = [1 zeros(1,D)];
den = [1 zeros(1,D-1) -a];
T = tf(num,den,1)
y = lsim(T,local);
figure(2), plot(t,y)
xlabel('Time (sec)')
ylabel('y')
title('a = 0.9, D = 200')
sound(y,fs)
pause
a = 1.005;
den = [1 zeros(1,D-1) -a];
T = tf(num,den,1)
y1 = lsim(T,local);
figure(3), plot(t,y1)
xlabel('Time (sec)')
ylabel('y1')
title('a = 1.005, D = 200')
sound(y1,fs)
%%%%%%%%%%
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -