📄 seance1.m
字号:
clc
close all
clear all
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% Sensibilisation with voice signal and hearing pattern properties%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Absolute Hearing Threshold %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure(1)
f=[0.02:0.01:20];
semilogx(f,Sa_(f));
% Ploting in semilog scale in order to have the same figure as the subject
xlabel('Frequency ');
ylabel('Decibel Sound Pressure Level (dB SPL)');
title('Absolute Hearing Edge');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Listening of the loading sound %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
fid = fopen('waziwaza.raw'); %fid negative mean the file couldn't be open
wave = fread(fid,'short');
soundsc(wave,16000);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Plotting of a temporal wave %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure(2)
t=[1/16000:1/16000:8550*2/16000];
plot(t,wave)
xlim([0 0.55]);
xlabel('time in second');
ylabel('amplitude of the wave');
title('temporal wave of waziwaza sound');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Disturbance and hearing of the noised signal %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure(3)
N=17100;
t=[1/16000:1/16000:N/16000];
sigma2=5*10^10;
noise = sqrt(sigma2)*randn(N,1); %Gaussian Centred White Noise with sigma2's variance
wave_noised = wave + noise; % noised wave
subplot 311
plot(t,noise)
xlim([0 0.55]);
xlabel('time in second');
ylabel('GCWN');
title('Gaussian Centred White Noise with sigma2''s variance');
subplot 312
plot(t,wave)
xlim([0 0.55]);
xlabel('time in second');
ylabel('wave amplitude');
title('Temporal signal of waziwaza sound');
subplot 313
plot(t,wave_noised)
xlim([0 0.55]);
ylim([-1*10^9 2*10^9]);
xlabel('time in second');
ylabel('Disturbed wave amplitude');
title('Temporal signal of waziwaza sound disturbed with a GCW Noised');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Visualisation de la r閜onse fr閝uentielle du filtre %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
b=[0.29,0.92,1.30,0.92,0.29];
a=[1,1.57,0.72,0.26,0.17];
[H,F] = freqz(b,a);
figure(5)
subplot 211
plot(F*16000/(2*pi),abs(H)); %amplitude
xlabel('f');
ylabel('amplitude |H(f)|');
title('Filter Frequency Response');
subplot 212
plot(F*16000/(2*pi),unwrap(angle(H))); %phase
xlabel('f');
ylabel('phase arg(H(f))');
figure(22)
zplane(b,a)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Filtrage du signal d'origine %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
y = filter(b,a,wave);
figure(6)
subplot 211
t=[1/16000:1/16000:8550*2/16000];
plot(t,wave)
xlim([0 0.55]);
xlabel('Time in second');
ylabel('Magnitude of the wave');
title('Temporal wave of waziwaza sound');
subplot 212
plot(t,y);
xlim([0 0.55]);
xlabel('Time in second');
ylabel(' Magnitude ');
title('Filtered Signal');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -