diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json index 7bb5857..b098119 100644 --- a/.obsidian/workspace.json +++ b/.obsidian/workspace.json @@ -219,6 +219,10 @@ }, "active": "8beea5ef99c3c6ed", "lastOpenFiles": [ + "ISEN/Traitement du signal/CIPA4/TP/TP3/~WRL0001.tmp", + "ISEN/Traitement du signal/CIPA4/TP/TP3/~WRD0000.tmp", + "ISEN/Traitement du signal/CIPA4/TP/TP3/TP3_Experience1.m", + "ISEN/Traitement du signal/CIPA4/TP/untitled.m", "ISEN/Réseau/CIPA4/TP/Module 5/M05 TP 01 - Packet_Tracer_Les_commandes.pka~", "ISEN/Réseau/CIPA4/TP/Module 4/M04 TP 01 - Communication.pdf", "ISEN/Réseau/CIPA4/TP/Module 4/M04 TP 02 -Packet_Tracer-La_communication.pka~", @@ -226,11 +230,7 @@ "ISEN/Traitement du signal/CIPA4/TP/TP2/TP2cipa_MARQUET.pdf", "ISEN/Traitement du signal/CIPA4/TP/TP2/~$P2cipa.docx", "ISEN/Traitement du signal/CIPA4/TP/TP2/TP2_Experience7.m", - "ISEN/Traitement du signal/CIPA4/TP/TP2/TP2_Experience6.m", - "ISEN/Traitement du signal/CIPA4/TP/TP2/TP2_Experience5.m", - "ISEN/Réseau/CIPA4/TP/Module 4/M04 TP 01 - Communication.pdf.sb-a92ffc2d-7qze7T", "ISEN/Réseau/CIPA4/TP/TP M02 Conversion.md", - "ISEN/Réseau/CIPA4/TP/Module 5/M05 TP 01 - Les commandes.pdf", "Protocol Data Units (PDU).md", "ISEN/English/CIPA4/Elevator pitch.md", "ISEN/English/CIPA4/24 oct 2025.md", diff --git a/ISEN/Traitement du signal/CIPA4/TP/TP3/TP3_Experience1.m b/ISEN/Traitement du signal/CIPA4/TP/TP3/TP3_Experience1.m new file mode 100644 index 0000000..45577e2 --- /dev/null +++ b/ISEN/Traitement du signal/CIPA4/TP/TP3/TP3_Experience1.m @@ -0,0 +1,74 @@ +%% Experiment 1 : Extract narrow-band jamming noise from Q2noisy +% Objective: +% - Load noisy audio file 'Q2noisy.wav' +% - Plot magnitude spectrum to identify jamming frequency +% - Design a Butterworth bandstop (notch) filter around that frequency +% - Filter the signal and save result as 'E71yourname.wav'. + +clc; +clear; +close all; + +%% 1) Load the WAV file +% Q2noisy.wav must be in the same folder as this script. + +[noisySig, Fs] = audioread('Q2noisy.wav'); % noisySig is a column vector, Fs in Hz + +% If stereo, convert to mono (average of channels) +if size(noisySig,2) > 1 + noisySig = mean(noisySig, 2); +end + +N = length(noisySig); % Number of samples +t = (0:N-1)/Fs; % Time axis (s) + +%% 2) Plot magnitude spectrum to locate jamming frequency + +% Compute FFT +X = fft(noisySig); +magX = abs(X); % Magnitude spectrum + +% Only positive frequencies (single-sided) +halfN = floor(N/2) + 1; +magX_half = magX(1:halfN); +f = (0:halfN-1) * (Fs/N); % Frequency axis in Hz + +figure('Name','Q2noisy - Magnitude spectrum'); +plot(f, magX_half, 'g'); +xlabel('Frequency (Hz)'); +ylabel('|X(f)|'); +title('Magnitude spectrum of Q2noisy (use this to read jamming frequency)'); +grid on; +xlim([0 Fs/2]); + +% >>> À partir de cette figure, lis la fréquence du pic étroit (jamming). +% Remplace "fJam" ci-dessous par la valeur observée (en Hz). + +fJam = 1000; % EXAMPLE ONLY: replace by the real jamming frequency you read + +%% 3) Design a suitable Butterworth bandstop (notch) filter + +% Choose a small stopband around the jamming frequency, e.g. ±50 Hz +deltaF = 50; % half-width of stopband (Hz) - adjust if needed + +f1 = (fJam - deltaF); % lower edge of stopband (Hz) +f2 = (fJam + deltaF); % upper edge of stopband (Hz) + +% Normalise frequencies w.r.t Nyquist (Fs/2) for BUTTER. +Wn = [f1 f2] / (Fs/2); % normalized stopband [0..1] + +% Filter order (higher -> sharper notch but more phase distortion) +Nfilt = 4; % 4th-order Butterworth bandstop (typical choice) + +[b, a] = butter(Nfilt, Wn, 'stop'); % bandstop (notch) filter + +% (Optionnel) Afficher la réponse fréquentielle du filtre +% figure; freqz(b,a,1024,Fs); grid on; + +%% 4) Filter the noisy signal + +cleanSig = filter(b, a, noisySig); % Apply the filter to remove narrow-band noise + +%% 5) Save the result + +audiowrite('E71marquet.wav', cleanSig, Fs); % change 'yourname' to your actual name diff --git a/ISEN/Traitement du signal/CIPA4/TP/TP3/TP3cipa.docx b/ISEN/Traitement du signal/CIPA4/TP/TP3/TP3cipa.docx index 1a74de6..69f868f 100644 Binary files a/ISEN/Traitement du signal/CIPA4/TP/TP3/TP3cipa.docx and b/ISEN/Traitement du signal/CIPA4/TP/TP3/TP3cipa.docx differ