Compare commits

...

15 Commits

Author SHA1 Message Date
55e263a996 Obisidian vault auto-backup: 06-01-2026 15:35:08 on . 1 files edited 2026-01-06 15:35:08 +01:00
b4a36e59c4 Obisidian vault auto-backup: 06-01-2026 15:04:53 on . 1 files edited 2026-01-06 15:04:53 +01:00
714609997b Obisidian vault auto-backup: 06-01-2026 14:14:31 on . 3 files edited 2026-01-06 14:14:31 +01:00
2d113b9c12 Obisidian vault auto-backup: 06-01-2026 13:54:21 on . 3 files edited 2026-01-06 13:54:21 +01:00
6819a1a59b Obisidian vault auto-backup: 06-01-2026 13:44:16 on . 4 files edited 2026-01-06 13:44:16 +01:00
b6655a7e71 Obisidian vault auto-backup: 06-01-2026 13:34:10 on . 5 files edited 2026-01-06 13:34:10 +01:00
04e3ea34ee Obisidian vault auto-backup: 06-01-2026 13:24:05 on . 3 files edited 2026-01-06 13:24:05 +01:00
ff7ad0d2fb Obisidian vault auto-backup: 06-01-2026 12:51:31 on . 2 files edited 2026-01-06 12:51:31 +01:00
949fad873f Obisidian vault auto-backup: 06-01-2026 12:01:13 on . 1 files edited 2026-01-06 12:01:13 +01:00
b985d3f6f8 Obisidian vault auto-backup: 06-01-2026 11:51:07 on . 1 files edited 2026-01-06 11:51:07 +01:00
bedd5ae6ee Obisidian vault auto-backup: 06-01-2026 11:41:00 on . 1 files edited 2026-01-06 11:41:00 +01:00
088148a389 Obisidian vault auto-backup: 06-01-2026 11:30:53 on . 1 files edited 2026-01-06 11:30:53 +01:00
625f6c5a4f Obisidian vault auto-backup: 06-01-2026 08:30:12 on . 2 files edited 2026-01-06 08:30:12 +01:00
04cd60bd9a Obisidian vault auto-backup: 06-01-2026 08:20:06 on . 2 files edited 2026-01-06 08:20:06 +01:00
b630b979bb Obisidian vault auto-backup: 06-01-2026 08:10:00 on . 1 files edited 2026-01-06 08:10:00 +01:00
11 changed files with 385 additions and 13 deletions

0
.obsidian/plugins/obsidian-git/obsidian_askpass.sh vendored Executable file → Normal file
View File

View File

@@ -37,10 +37,10 @@
"state": {
"type": "pdf",
"state": {
"file": "ISEN/Réseau/CIPA4/TP/Module 4/M04 TP 01 - Communication.pdf"
"file": "ISEN/Réseau/CIPA4/TP/Module 5/M05 TP 01 - Les commandes.pdf"
},
"icon": "lucide-file-text",
"title": "M04 TP 01 - Communication"
"title": "M05 TP 01 - Les commandes"
}
}
],
@@ -219,18 +219,18 @@
},
"active": "8beea5ef99c3c6ed",
"lastOpenFiles": [
"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 02 -Packet_Tracer-La_communication.pka~",
"ISEN/Réseau/CIPA4/TP/Module 4/M04 TP 01 - Communication.pdf.sb-a92ffc2d-7qze7T",
"ISEN/Traitement du signal/CIPA4/TP/TP3/~WRL1687.tmp",
"ISEN/Traitement du signal/CIPA4/TP/TP3/~WRD1680.tmp",
"ISEN/Traitement du signal/CIPA4/TP/TP3/~WRL0051.tmp",
"ISEN/Traitement du signal/CIPA4/TP/TP3/~WRD0039.tmp",
"ISEN/Traitement du signal/CIPA4/TP/TP3/~WRL0467.tmp",
"ISEN/Traitement du signal/CIPA4/TP/TP3/~WRD0460.tmp",
"ISEN/Traitement du signal/CIPA4/TP/TP3/~WRL2779.tmp",
"ISEN/Traitement du signal/CIPA4/TP/TP3/~WRD2775.tmp",
"ISEN/Traitement du signal/CIPA4/TP/TP3/~WRL2809.tmp",
"ISEN/Traitement du signal/CIPA4/TP/TP3/~WRD2801.tmp",
"ISEN/Traitement du signal/CIPA4/TP/TP3/TP3_Experience3.m",
"ISEN/Réseau/CIPA4/TP/TP M02 Conversion.md",
"ISEN/Réseau/CIPA4/TP/Module 4/M04 TP 01 - Communication.pdf",
"ISEN/Réseau/CIPA4/TP/Module 5/M05 TP 01 - Les commandes.pdf",
"ISEN/Réseau/CIPA4/TP/Module 6/M06 TP 01 - IPv6.pdf",
"ISEN/Réseau/CIPA4/TP/Module 6",
"Protocol Data Units (PDU).md",
"ISEN/English/CIPA4/Elevator pitch.md",
"ISEN/English/CIPA4/24 oct 2025.md",

Binary file not shown.

View File

@@ -0,0 +1,71 @@
%% 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');
grid on;
xlim([0 Fs/2]);
fJam = 5000;
%% 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);

View File

@@ -0,0 +1,172 @@
%% Experiment 2 : Raised cosine with jamming and ambient noise
% - Generate raised cosine h(t) on [-10T, 10T], T = 2 ms, beta = 0.5
% - Sampling period Ts = 0.13*T
% - Add narrowband jamming at 800 Hz and white noise
% - Design IIR notch filter (order 15 then 5) to remove the jamming tone
% - Use subplot to show time-domain signal and magnitude spectrum.
clc;
clear;
close all;
%% 1) Parameters and time vector
T = 2e-3; % Symbol period (s)
beta = 0.5; % Roll-off factor
Ts = 0.13 * T; % Sampling period (s)
Fs = 1 / Ts; % Sampling frequency (Hz)
t = -10*T : Ts : 10*T; % Time vector
N = length(t);
% Frequency axis for spectra (centered)
f_axis = (-N/2 : N/2-1) * (Fs / N); % Hz
%% 2) Raised cosine pulse h(t)
h = arrayfun(@(tt) raisedCosineSample(tt, T, beta), t);
% Time-domain h(t) and magnitude spectrum
H = fft(h);
magH = abs(fftshift(H)); % magnitude, zero frequency at center
figure('Name','Experiment 2 - h(t) and |H(f)|');
subplot(2,1,1);
plot(t*1e3, h, 'g');
xlabel('Time (ms)');
ylabel('h(t)');
title('Raised cosine pulse h(t), \beta = 0.5');
grid on;
subplot(2,1,2);
plot(f_axis, magH, 'g');
xlabel('Frequency (Hz)');
ylabel('|H(f)|');
title('Magnitude spectrum |H(f)| of raised cosine');
grid on;
%% 3) Generate jamming and ambient noise, build z(t)
fJam = 800; % Jamming frequency (Hz)
x = 0.2 * cos(2*pi*fJam*t); % narrowband jamming (adjust amplitude if needed)
n = 0.02 * randn(size(t)); % ambient white noise (low level)
z = h + x + n; % corrupted signal
% Time-domain and magnitude spectrum of z(t)
Z = fft(z);
magZ = abs(fftshift(Z));
figure('Name','Experiment 2 - z(t) and |Z(f)|');
subplot(2,1,1);
plot(t*1e3, z, 'g');
xlabel('Time (ms)');
ylabel('z(t)');
title('Noisy signal z(t) = h(t) + jamming + white noise');
grid on;
subplot(2,1,2);
plot(f_axis, magZ, 'g');
xlabel('Frequency (Hz)');
ylabel('|Z(f)|');
title('Magnitude spectrum |Z(f)| with jamming at 800 Hz');
grid on;
%% 4) Design 15th-order notch (bandstop) filter at 800 Hz (no butter)
% We build an IIR notch with zeros at exp(±j*w0) and poles at r*exp(±j*w0),
% then cascade enough sections to reach an effective order 15.
w0 = 2*pi*fJam/Fs; % digital radian frequency
r = 0.98; % pole radius (controls notch width)
% One second-order notch section:
b_sec = [1, -2*cos(w0), 1]; % zeros at e^{±jw0}
a_sec = [1, -2*r*cos(w0), r^2]; % poles at r*e^{±jw0}
% Approximate 15th-order by cascading 8 sections (~16th order)
sections = 8;
b15 = 1;
a15 = 1;
for k = 1:sections
b15 = conv(b15, b_sec);
a15 = conv(a15, a_sec);
end
% Filter output zz(t) and its spectrum
zz15 = filter(b15, a15, z);
ZZ15 = fft(zz15);
magZZ15 = abs(fftshift(ZZ15));
figure('Name','Experiment 2 - Order ~15 notch filter');
subplot(2,1,1);
plot(t*1e3, zz15, 'g');
xlabel('Time (ms)');
ylabel('zz_{15}(t)');
title('Filtered signal (notch order 15)');
grid on;
subplot(2,1,2);
plot(f_axis, magZZ15, 'g');
xlabel('Frequency (Hz)');
ylabel('|ZZ_{15}(f)|');
title('Magnitude spectrum after order 15 notch filter');
grid on;
%% 5) Modify filter order to ~5 and update plot
% Fewer cascaded sections (e.g. 3 -> ~6th order)
sections2 = 3;
b5 = 1;
a5 = 1;
for k = 1:sections2
b5 = conv(b5, b_sec);
a5 = conv(a5, a_sec);
end
zz5 = filter(b5, a5, z);
ZZ5 = fft(zz5);
magZZ5 = abs(fftshift(ZZ5));
figure('Name','Experiment 2 - Order ~5 notch filter');
subplot(2,1,1);
plot(t*1e3, zz5, 'g');
xlabel('Time (ms)');
ylabel('zz_{5}(t)');
title('Filtered signal (notch order 5)');
grid on;
subplot(2,1,2);
plot(f_axis, magZZ5, 'g');
xlabel('Frequency (Hz)');
ylabel('|ZZ_{5}(f)|');
title('Magnitude spectrum after order 5 notch filter');
grid on;
%% ===== Local function: one sample of raised cosine pulse =====
function h = raisedCosineSample(t, T, beta)
% Raised cosine pulse sample at time t (scalar).
% h(t) = sinc(t/T) * cos(pi*beta*t/T) / (1 - (4*beta^2*t^2)/T^2)
% with sinc(x) = sin(pi*x)/(pi*x).
x = t / T;
% Manual sinc(x)
if abs(x) < 1e-12
sx = 1; % limit at x -> 0
else
sx = sin(pi*x) / (pi*x);
end
% Handle critical points of the raised cosine denominator
if abs(t) < 1e-12
h = 1;
elseif beta ~= 0 && abs(abs(t) - T/(2*beta)) < 1e-12
h = (beta/pi) * sin(pi/(2*beta)); % limit at t = ±T/(2*beta)
else
h = sx * cos(pi*beta*x) / (1 - (4*beta^2*x^2));
end
end

View File

@@ -0,0 +1,129 @@
%% Experiment 3 : Modulation and demodulation of a guitar signal
% Load guitar signal y(t) from 'guitar.wav'
% Fmod = 8820 Hz
% ym(t) = y(t) * sin(2*pi*Fmod*t)
% ys(t) = ym(t) * sin(2*pi*Fmod*t)
% yc(t) = ym(t) * cos(2*pi*Fmod*t)
% Plot amplitude spectrum of y, ym, ys, yc and listen to each.
clc;
clear;
close all;
%% 1) Load audio file
[y, Fs] = audioread('guitar.wav'); % y: audio vector, Fs: sampling rate
if size(y,2) > 1
y = mean(y,2); % convert to mono if stereo
end
N = length(y);
t = (0:N-1)/Fs; % time vector
Fmod = 8820; % modulation frequency in Hz
%% 2) Generate modulated signals
ym = y .* sin(2*pi*Fmod*t.'); % column vector; DSB-SC around ±Fmod
ys = ym .* sin(2*pi*Fmod*t.'); % second multiplication by sin
yc = ym .* cos(2*pi*Fmod*t.'); % multiplication by cos
%% 3) Helper to compute single-sided amplitude spectrum |Y(f)|
computeSpec = @(sig) ...
deal( ...
(0:floor(length(sig)/2)) * (Fs/length(sig)), ... % f axis
abs(fft(sig)) / length(sig) ... % scale
);
[f_y, P_y] = computeSpec(y);
[f_ym, P_ym] = computeSpec(ym);
[f_ys, P_ys] = computeSpec(ys);
[f_yc, P_yc] = computeSpec(yc);
P_y = P_y(1:length(f_y));
P_ym = P_ym(1:length(f_ym));
P_ys = P_ys(1:length(f_ys));
P_yc = P_yc(1:length(f_yc));
%% 4) Plot amplitude spectra
figure('Name','Amplitude spectra of y, ym, ys, yc');
subplot(4,1,1);
plot(f_y, P_y(1:numel(f_y)), 'g');
xlim([0 Fs/2]);
xlabel('Frequency (Hz)');
ylabel('|Y(f)|');
title('Original signal y(t) - spectrum');
grid on;
subplot(4,1,2);
plot(f_ym, P_ym(1:numel(f_ym)), 'g');
xlim([0 Fs/2]);
xlabel('Frequency (Hz)');
ylabel('|Y_m(f)|');
title('ym(t) = y(t) * sin(2\pi F_{mod} t)');
grid on;
subplot(4,1,3);
plot(f_ys, P_ys(1:numel(f_ys)), 'g');
xlim([0 Fs/2]);
xlabel('Frequency (Hz)');
ylabel('|Y_s(f)|');
title('ys(t) = ym(t) * sin(2\pi F_{mod} t)');
grid on;
subplot(4,1,4);
plot(f_yc, P_yc(1:numel(f_yc)), 'g');
xlim([0 Fs/2]);
xlabel('Frequency (Hz)');
ylabel('|Y_c(f)|');
title('yc(t) = ym(t) * cos(2\pi F_{mod} t)');
grid on;
%% 5) Listen to the signals (uncomment in MATLAB to hear)
% sound(y, Fs); pause(length(y)/Fs + 1);
% sound(ym, Fs); pause(length(y)/Fs + 1);
% sound(ys, Fs); pause(length(y)/Fs + 1);
% sound(yc, Fs);
%% 6) Demodulation to recover original sound
% Theory:
% - ym(t) = y(t)*sin(2*pi*Fmod*t) is DSB-SC modulation.
% - Multiplying again by sin(2*pi*Fmod*t) gives:
% ys(t) = ym(t)*sin(2*pi*Fmod*t)
% = y(t)*sin^2(2*pi*Fmod*t)
% = 0.5*y(t) - 0.5*y(t)*cos(4*pi*Fmod*t)
% => low-frequency term 0.5*y(t) + high-frequency image around 2*Fmod.
% - A low-pass filter on ys(t) recovers a scaled version of y(t).
%
% So ys(t) is the best candidate for demodulation.
% Simple low-pass filter: moving average (FIR) without toolboxes.
% Choose window length so cut-off is << Fmod (keep audio band, remove 2*Fmod).
LpOrder = 101; % odd length for symmetry
h_lp = ones(LpOrder,1)/LpOrder; % simple averaging filter
y_rec = filter(h_lp, 1, ys); % demodulated / low-passed version
% Optionally compensate scaling (~0.5) by multiplying by 2
y_rec = 2 * y_rec;
%% 7) Spectrum of demodulated signal
[f_rec, P_rec] = computeSpec(y_rec);
P_rec = P_rec(1:length(f_rec));
figure('Name','Demodulated signal spectrum');
plot(f_rec, P_rec, 'g');
xlim([0 Fs/2]);
xlabel('Frequency (Hz)');
ylabel('|Y_{rec}(f)|');
title('Amplitude spectrum of demodulated signal (approx. original y(t))');
grid on;
%% 8) Listen to recovered sound (optional)
% sound(y_rec, Fs);

Binary file not shown.