Obisidian vault auto-backup: 05-01-2026 14:48:31 on . 5 files edited

This commit is contained in:
Félix MARQUET
2026-01-05 14:48:31 +01:00
parent dac0992d9f
commit f71e7a5d9c
5 changed files with 186 additions and 2 deletions

View File

@@ -219,6 +219,8 @@
},
"active": "8beea5ef99c3c6ed",
"lastOpenFiles": [
"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/Traitement du signal/CIPA4/TP/TP2/~$P2cipa.docx",
"ISEN/Réseau/CIPA4/TP/Module 4/M04 TP 02 -Packet_Tracer-La_communication.pka~",
@@ -229,8 +231,6 @@
"ISEN/Réseau/CIPA4/TP/Module 6/M06 TP 01 - IPv6.pdf",
"ISEN/Réseau/CIPA4/TP/Module 6",
"ISEN/Réseau/CIPA4/TP/dossier sans titre",
"ISEN/Réseau/CIPA4/TP/Module 5/M05 TP 01 - Packet_Tracer_Les_commandes.pka",
"ISEN/Réseau/CIPA4/TP/Module 5",
"Protocol Data Units (PDU).md",
"ISEN/English/CIPA4/Elevator pitch.md",
"ISEN/English/CIPA4/24 oct 2025.md",

View File

@@ -0,0 +1,51 @@
%% Experiment 5 : Magnitude spectrum of x(t)
% x(t) = cos(2*pi + 20000*t) * sin(2*pi*30000*t) + 2*cos(22000*t)
% Time interval: [0, 0.4 s]
clc;
clear;
close all;
%% 1) Define continuous-time parameters (for information)
% Angular frequencies (rad/s)
w1 = 20000; % from cos(2*pi + 20000*t) -> cos(20000*t)
w2 = 2*pi*30000; % from sin(2*pi*30000*t)
w3 = 22000; % from cos(22000*t)
% Corresponding frequencies (Hz)
f1 = w1/(2*pi) + 30000; % highest frequency component
f2 = 30000 - w1/(2*pi); % lower side frequency
f3 = w3/(2*pi); % from cos(22000*t)
f_max = f1; % maximum frequency in the signal
%% 2) Choose sampling frequency Fs and period Ts
Fs = 5 * 2 * f_max; % Fs chosen well above 2*f_max (safety factor 5)
Ts = 1 / Fs; % Sampling period (s)
%% 3) Build time vector on [0, 0.4 s]
T_end = 0.4;
t = 0 : Ts : T_end; % Time vector
N = length(t); % Number of samples
%% 4) Generate sampled signal x[n] = x(t)
x = cos(2*pi + 20000*t) .* sin(2*pi*30000*t) + 2*cos(22000*t);
%% 5) Compute FFT and magnitude spectrum (single-sided)
X = fft(x); % N-point FFT of x
magX = abs(X); % Magnitude spectrum
halfN = floor(N/2) + 1; % First half (real signal -> symmetric)
magX_half = magX(1:halfN);
% Frequency axis in Hz
f = (0:halfN-1) * (Fs/N); % f_k = k * Fs / N
%% 6) Plot magnitude spectrum
figure;
plot(f, magX_half, 'g'); % Green magnitude spectrum
xlabel('Frequency (Hz)');
ylabel('|X(f)|');
title('Experiment 5 : Magnitude spectrum of x(t)');
grid on;

View File

@@ -0,0 +1,37 @@
%% Experiment 6 : Magnitude spectrum of x(t)
% Sampling period Ts = 0.5 ms, time interval [0, 2 s]
% x(t) = sin(4000 t) + 2 cos(4000 t - 32) + cos^2(2000 t)
clc;
clear;
close all;
%% 1) Sampling parameters
Ts = 0.5e-3; % Sampling period (s)
Fs = 1 / Ts; % Sampling frequency (Hz) -> 2000 Hz
t = 0 : Ts : 2; % Time vector from 0 to 2 s
N = length(t); % Number of samples
%% 2) Generate the signal x(t)
x = sin(4000*t) + 2*cos(4000*t - 32) + cos(2000*t).^2;
%% 3) Compute FFT and magnitude spectrum (single-sided)
X = fft(x); % N-point FFT of x(t)
magX = abs(X); % Magnitude spectrum
halfN = floor(N/2) + 1; % First half (real signal -> symmetric)
magX_half = magX(1:halfN);
% Frequency axis in Hz
f = (0:halfN-1) * (Fs/N); % f_k = k * Fs / N
%% 4) Plot magnitude spectrum
figure;
plot(f, magX_half, 'g'); % Green magnitude spectrum
xlabel('Frequency (Hz)');
ylabel('|X(f)|');
title('Experiment 6 : Magnitude spectrum of x(t)');
grid on;

View File

@@ -0,0 +1,96 @@
%% Experiment 7 : Spectral Analysis of the raised cosine waveform
clc;
clear;
close all;
%% Common parameters
T = 2e-3; % Symbol period (s)
Ts = 0.13 * T; % Sampling period (s)
Fs = 1 / Ts; % Sampling frequency (Hz)
t = -10*T : Ts : 10*T; % Time vector from -10T to 10T
N = length(t); % Number of samples
%% Helper function: raised cosine pulse (inline)
% We handle the singularities at t = 0 and t = ±T/(2*beta) using limits.
rc_pulse = @(beta) ...
arrayfun(@(tt) ...
raisedCosineSample(tt, T, beta), t);
%% ===== a) & b) for beta = 0.5 =====
beta1 = 0.5;
h1 = rc_pulse(beta1); % Time-domain raised cosine pulse
% --- Time-domain plot (x-axis in ms) ---
figure('Name','Experiment 7 - Time domain, beta = 0.5');
plot(t*1e3, h1, 'g'); % t in ms
xlabel('Time (ms)');
ylabel('h(t)');
title('Raised cosine pulse h(t), \beta = 0.5');
grid on;
% --- Frequency-domain magnitude spectrum ---
H1 = fft(h1); % FFT of the pulse
magH1 = abs(fftshift(H1)); % Center zero frequency; take magnitude
% Frequency axis in Hz, centered around 0
f_axis = (-N/2:N/2-1) * (Fs/N);
figure('Name','Experiment 7 - Frequency domain, beta = 0.5');
plot(f_axis, magH1, 'g');
xlabel('Frequency (Hz)');
ylabel('|H(f)|');
title('Magnitude spectrum of raised cosine pulse, \beta = 0.5');
grid on;
% --- c) Measure bandwidth (approximate)
% For a raised cosine with symbol rate Rs = 1/T, ideal theoretical
% baseband bandwidth is B = (Rs/2)*(1+beta).
Rs = 1/T; % Symbol rate (Hz)
BW_theo1 = (Rs/2) * (1 + beta1); % Theoretical bandwidth (Hz)
fprintf('Theoretical bandwidth for beta=0.5: %.2f Hz\n', BW_theo1);
%% ===== d) Repeat for beta = 0.25 =====
beta2 = 0.25;
h2 = rc_pulse(beta2);
% Time-domain plot
figure('Name','Experiment 7 - Time domain, beta = 0.25');
plot(t*1e3, h2, 'g');
xlabel('Time (ms)');
ylabel('h(t)');
title('Raised cosine pulse h(t), \beta = 0.25');
grid on;
% Frequency-domain magnitude spectrum
H2 = fft(h2);
magH2 = abs(fftshift(H2));
figure('Name','Experiment 7 - Frequency domain, beta = 0.25');
plot(f_axis, magH2, 'g');
xlabel('Frequency (Hz)');
ylabel('|H(f)|');
title('Magnitude spectrum of raised cosine pulse, \beta = 0.25');
grid on;
BW_theo2 = (Rs/2) * (1 + beta2);
fprintf('Theoretical bandwidth for beta=0.25: %.2f Hz\n', BW_theo2);
%% ===== Local function for one sample of raised cosine =====
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)
% Special cases at t = 0 and t = ±T/(2*beta) use L'Hospital limits.
if abs(t) < 1e-12
% Limit at t -> 0
h = 1; % sinc(0) = 1 and cos(0)/(1-0) = 1
elseif beta ~= 0 && abs(abs(t) - T/(2*beta)) < 1e-12
% Singularities at t = ±T/(2*beta) -> use known limit value
h = (beta/pi) * sin(pi/(2*beta));
else
x = t / T;
h = sinc(x) * cos(pi*beta*x) / (1 - (4*beta^2*x^2));
end
end