mirror of
https://github.com/BreizhHardware/cours-ISEN-MD.git
synced 2026-03-18 21:50:46 +01:00
Obisidian vault auto-backup: 06-01-2026 13:24:05 on . 3 files edited
This commit is contained in:
8
.obsidian/workspace.json
vendored
8
.obsidian/workspace.json
vendored
@@ -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",
|
||||
|
||||
74
ISEN/Traitement du signal/CIPA4/TP/TP3/TP3_Experience1.m
Normal file
74
ISEN/Traitement du signal/CIPA4/TP/TP3/TP3_Experience1.m
Normal file
@@ -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
|
||||
Binary file not shown.
Reference in New Issue
Block a user