mirror of
https://github.com/BreizhHardware/cours-ISEN-MD.git
synced 2026-01-18 16:47:24 +01:00
Compare commits
13 Commits
87283ae8b7
...
d7867f2850
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d7867f2850 | ||
|
|
63ae5c2a9a | ||
|
|
f71e7a5d9c | ||
|
|
dac0992d9f | ||
|
|
4aba17d3a5 | ||
|
|
e571c77625 | ||
|
|
f785ff9a61 | ||
|
|
314065fbc3 | ||
|
|
67e58bc174 | ||
|
|
101a12791b | ||
|
|
c8f8c8d599 | ||
|
|
a54f9eb747 | ||
|
|
c1fff558c1 |
41
.obsidian/workspace.json
vendored
41
.obsidian/workspace.json
vendored
@@ -30,8 +30,21 @@
|
||||
"icon": "lucide-file",
|
||||
"title": "24 oct 2025"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "8beea5ef99c3c6ed",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "pdf",
|
||||
"state": {
|
||||
"file": "ISEN/Réseau/CIPA4/TP/Module 4/M04 TP 01 - Communication.pdf"
|
||||
},
|
||||
"icon": "lucide-file-text",
|
||||
"title": "M04 TP 01 - Communication"
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
"currentTab": 1
|
||||
}
|
||||
],
|
||||
"direction": "vertical"
|
||||
@@ -204,11 +217,22 @@
|
||||
"obsidian-git:Open Git source control": false
|
||||
}
|
||||
},
|
||||
"active": "f8adac6650611d50",
|
||||
"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~",
|
||||
"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 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",
|
||||
"ISEN/Réseau/CIPA4/TP/dossier sans titre",
|
||||
"Protocol Data Units (PDU).md",
|
||||
"ISEN/English/CIPA4/Elevator pitch.md",
|
||||
"Untitled.base",
|
||||
"ISEN/English/CIPA4/24 oct 2025.md",
|
||||
"ISEN/English/CIPA4/29 sept 2025.md",
|
||||
"ISEN/BDD/CIPA4/BDD Cours 1.md",
|
||||
@@ -224,15 +248,6 @@
|
||||
"ISEN/Réseau/A2/CCNA Cours 3.md",
|
||||
"Elevator.md",
|
||||
"ISEN/JAVA/CIPA4/TP/TP2/TP2.md",
|
||||
"ISEN/JAVA/CIPA4/CM/10_JDBC.pdf",
|
||||
"ISEN/JAVA/CIPA4/CM/09-fichiers.pdf",
|
||||
"ISEN/JAVA/CIPA4/CM/08-collections.pdf",
|
||||
"ISEN/JAVA/CIPA4/CM/07-exceptions.pdf",
|
||||
"ISEN/JAVA/CIPA4/CM/06-threads.pdf",
|
||||
"ISEN/JAVA/CIPA4/CM/05-swing.pdf",
|
||||
"ISEN/JAVA/CIPA4/CM/04-classes-abstraites-interfaces.pdf",
|
||||
"ISEN/JAVA/CIPA4/CM/03-heritage.pdf",
|
||||
"ISEN/JAVA/CIPA4/CM/02-classes.pdf",
|
||||
"ISEN/FHS/A1/Réunion stage associatif.md",
|
||||
"ISEN/FHS/A1/Démocratie/Démocracie cours 7.md",
|
||||
"ISEN/BDD/CIPA4/modelisation-cas-immo.md",
|
||||
@@ -240,8 +255,6 @@
|
||||
"ISEN/BDD/CIPA4/BDD Cours 2.md",
|
||||
"ISEN/FHS/CIPA4/Anthropologie de l'entreprise/Mythe Horoquartz.md",
|
||||
"ISEN/FHS/CIPA4/Anthropologie de l'entreprise/Anthropologie de l'entreprise Cours 1.md",
|
||||
"ISEN/BDD/CIPA4/Projet/Présentation projet.md",
|
||||
"ISEN/Réunion/CIPA 4/Réunion international.md",
|
||||
"Pasted image 20251009192656.png",
|
||||
"src/Pasted image 20240130111505.png",
|
||||
"src/Pasted image 20240123120819.png",
|
||||
|
||||
Binary file not shown.
Binary file not shown.
BIN
ISEN/Réseau/CIPA4/TP/Module 5/M05 TP 01 - Les commandes.pdf
Normal file
BIN
ISEN/Réseau/CIPA4/TP/Module 5/M05 TP 01 - Les commandes.pdf
Normal file
Binary file not shown.
Binary file not shown.
BIN
ISEN/Réseau/CIPA4/TP/Module 6/M06 TP 01 - IPv6.pdf
Normal file
BIN
ISEN/Réseau/CIPA4/TP/Module 6/M06 TP 01 - IPv6.pdf
Normal file
Binary file not shown.
80
ISEN/Traitement du signal/CIPA4/TP/TP2/TP2_Experience1.m
Normal file
80
ISEN/Traitement du signal/CIPA4/TP/TP2/TP2_Experience1.m
Normal file
@@ -0,0 +1,80 @@
|
||||
%% Experiment 1 : FFT of sinusoidal mixtures (magnitude spectra only)
|
||||
|
||||
clc;
|
||||
clear;
|
||||
close all;
|
||||
|
||||
%% ========================== PART i ==========================
|
||||
%% i) Ts = 0.2 ms, t in [0, 4 s]
|
||||
|
||||
Ts1 = 0.2e-3; % Sampling period (s)
|
||||
Fs1 = 1 / Ts1; % Sampling frequency (Hz)
|
||||
t1 = 0 : Ts1 : 4; % Time vector
|
||||
N1 = length(t1); % Number of samples
|
||||
|
||||
fi1 = Fs1 / N1; % Frequency resolution (Hz)
|
||||
k1 = 0 : (N1-1); % FFT index vector
|
||||
f_full_1 = k1 * fi1; % Full frequency axis
|
||||
|
||||
% Signal: x(t) = sin(2000 t + 56) * sin(56 - 6000 t) + 2 cos(4000 t)
|
||||
x1 = sin(2000*t1 + 56) .* sin(56 - 6000*t1) + 2*cos(4000*t1);
|
||||
|
||||
%% i-a) Magnitude spectrum of x(t) (single-sided)
|
||||
|
||||
X1 = fft(x1); % N-point FFT
|
||||
half_N1 = floor(N1/2) + 1; % Length of single-sided spectrum
|
||||
X1_half = X1(1:half_N1); % Positive frequencies only
|
||||
f1_half = f_full_1(1:half_N1); % Frequency axis (Hz)
|
||||
magX1 = abs(X1_half); % Magnitude of complex spectrum
|
||||
|
||||
figure('Name','Part i-a: |X(f)| of x(t)');
|
||||
plot(f1_half, magX1, 'r-');
|
||||
title('Part i-a: magnitude spectrum |X(f)| of x(t)');
|
||||
xlabel('Frequency (Hz)');
|
||||
ylabel('|X(f)|');
|
||||
grid on;
|
||||
|
||||
%% i-b) Magnitude spectrum of x^2(t) (single-sided)
|
||||
|
||||
x2 = x1.^2; % x^2(t)
|
||||
X2 = fft(x2); % FFT of x^2(t)
|
||||
|
||||
X2_half = X2(1:half_N1);
|
||||
magX2 = abs(X2_half);
|
||||
% Same frequency axis f1_half
|
||||
|
||||
figure('Name','Part i-b: |X_2(f)| of x^2(t)');
|
||||
plot(f1_half, magX2, 'm-');
|
||||
title('Part i-b: magnitude spectrum |X_2(f)| of x^2(t)');
|
||||
xlabel('Frequency (Hz)');
|
||||
ylabel('|X_2(f)|');
|
||||
grid on;
|
||||
|
||||
%% ========================== PART ii ==========================
|
||||
%% ii) Fs = 5 kHz, t in [0, 2 s]
|
||||
% x(t) = cos(2000 t^2) + 0.01 sin(2000 t) + 0.01 sin(10000 t)
|
||||
|
||||
Fs2 = 5000; % Sampling frequency (Hz)
|
||||
Ts2 = 1 / Fs2; % Sampling period (s)
|
||||
t2 = 0 : Ts2 : 2; % Time vector
|
||||
N2 = length(t2); % Number of samples
|
||||
|
||||
fi2 = Fs2 / N2; % Frequency resolution
|
||||
k2 = 0 : (N2-1);
|
||||
f_full_2 = k2 * fi2;
|
||||
|
||||
x3 = cos(2000*t2.^2) + 0.01*sin(2000*t2) + 0.01*sin(10000*t2);
|
||||
|
||||
X3 = fft(x3); % FFT
|
||||
|
||||
half_N2 = floor(N2/2) + 1;
|
||||
X3_half = X3(1:half_N2);
|
||||
f2_half = f_full_2(1:half_N2);
|
||||
magX3 = abs(X3_half);
|
||||
|
||||
figure('Name','Part ii: |X(f)| of chirp signal');
|
||||
plot(f2_half, magX3, 'b-');
|
||||
title('Part ii: magnitude spectrum |X(f)| of x(t)');
|
||||
xlabel('Frequency (Hz)');
|
||||
ylabel('|X(f)|');
|
||||
grid on;
|
||||
49
ISEN/Traitement du signal/CIPA4/TP/TP2/TP2_Experience2.m
Normal file
49
ISEN/Traitement du signal/CIPA4/TP/TP2/TP2_Experience2.m
Normal file
@@ -0,0 +1,49 @@
|
||||
%% Experiment 2 : Recreation of a signal
|
||||
|
||||
clc;
|
||||
clear;
|
||||
close all;
|
||||
|
||||
Fs = 4000; % Sampling frequency (Hz)
|
||||
N = 2048; % Number of samples
|
||||
t = (0:N-1)/Fs; % Time vector (s)
|
||||
|
||||
df = Fs/N; % Frequency resolution (Hz)
|
||||
|
||||
% --- 1) Desired peak frequencies (Hz) ---
|
||||
f_target = [300 400 700 1300 1600 1700];
|
||||
|
||||
% Align each frequency with the closest FFT bin to avoid spectral leakage.
|
||||
k = round(f_target/df); % Integer FFT bin indices
|
||||
f = k * df; % Actual frequencies used (bin-aligned)
|
||||
|
||||
% --- 2) Desired peak heights in |FFT| ---
|
||||
H = [1000 2000 3250 3250 2000 1000];
|
||||
|
||||
% --- 3) Amplitudes of the cosines for those peak heights ---
|
||||
% For a cosine perfectly aligned to a bin, the peak in |FFT| is about N*A/2,
|
||||
% so we choose A = 2*H/N to obtain the target height H.
|
||||
A = 2*H / N;
|
||||
|
||||
% --- 4) Build the time-domain signal y(t) as a sum of cosines ---
|
||||
% Random phases are used because the magnitude spectrum does not depend on phase.
|
||||
phi = 2*pi*rand(size(f)); % Random phase for each component
|
||||
y = zeros(size(t)); % Initialize signal
|
||||
|
||||
for i = 1:length(f)
|
||||
y = y + A(i) * cos(2*pi*f(i)*t + phi(i));
|
||||
end
|
||||
|
||||
% --- 5) Compute FFT and plot the magnitude spectrum ---
|
||||
Y = fft(y); % Complex FFT of y(t)
|
||||
Py = abs(Y); % Magnitude of the FFT (two-sided, unnormalized)
|
||||
|
||||
f_axis = (0:N-1) * df; % Frequency axis (Hz)
|
||||
|
||||
figure;
|
||||
stem(f_axis, Py, 'g'); % Discrete spectrum as vertical lines
|
||||
xlim([0 Fs/2]); % Show only positive frequencies up to Nyquist
|
||||
xlabel('Frequency (Hz)');
|
||||
ylabel('|Y(f)|');
|
||||
title('Magnitude spectrum with target peak heights');
|
||||
grid on;
|
||||
31
ISEN/Traitement du signal/CIPA4/TP/TP2/TP2_Experience3.m
Normal file
31
ISEN/Traitement du signal/CIPA4/TP/TP2/TP2_Experience3.m
Normal file
@@ -0,0 +1,31 @@
|
||||
%% Experiment 3 : Power spectrum of "holiday_offer"
|
||||
% Plot the power spectrum with the same style as the TP figure. [web:81][web:155]
|
||||
|
||||
clc;
|
||||
clear;
|
||||
close all;
|
||||
|
||||
% 1) Load signal from MAT-file
|
||||
data = load('holiday_offer.mat');
|
||||
varNames = fieldnames(data);
|
||||
signalName = varNames{1};
|
||||
x = data.(signalName); % time-domain signal vector
|
||||
|
||||
Fs = 11025; % Sampling frequency (Hz)
|
||||
|
||||
% 2) FFT-based power spectrum (periodogram)
|
||||
N = length(x);
|
||||
Xdft = fft(x);
|
||||
Pxx = (1/N) * abs(Xdft).^2; % power spectrum estimate [web:154]
|
||||
|
||||
% We keep the FULL spectrum (both sides) as in the given figure
|
||||
f = (0:N-1) * (Fs/N); % frequency axis from 0 to Fs (≈11025 Hz)
|
||||
|
||||
% 3) Plot
|
||||
figure;
|
||||
plot(f, Pxx, 'g');
|
||||
xlabel('Frequency (Hz)');
|
||||
ylabel('Power');
|
||||
title('Power spectrum of holiday\_offer signal');
|
||||
grid on;
|
||||
xlim([0 Fs]);
|
||||
58
ISEN/Traitement du signal/CIPA4/TP/TP2/TP2_Experience4.m
Normal file
58
ISEN/Traitement du signal/CIPA4/TP/TP2/TP2_Experience4.m
Normal file
@@ -0,0 +1,58 @@
|
||||
%% Experiment 4 : Magnitude spectra of composed signals
|
||||
|
||||
clc;
|
||||
clear;
|
||||
close all;
|
||||
|
||||
%% ========================== PART i ==========================
|
||||
% i) Set the sampling period to 0.5 ms and time interval [0, 2 s]
|
||||
% x(t) = sin(4000 t) + 2 cos(4000 t - 32) + cos^2(2000 t)
|
||||
|
||||
Ts1 = 0.5e-3; % Sampling period (s)
|
||||
Fs1 = 1 / Ts1; % Sampling frequency (Hz) -> 2000 Hz
|
||||
t1 = 0 : Ts1 : 2; % Time vector (s)
|
||||
N1 = length(t1); % Number of samples
|
||||
|
||||
% Define the signal x1(t)
|
||||
x1 = sin(4000*t1) + 2*cos(4000*t1 - 32) + cos(2000*t1).^2;
|
||||
|
||||
% FFT and magnitude spectrum (single-sided)
|
||||
X1 = fft(x1); % Complex FFT of x1
|
||||
magX1 = abs(X1); % Magnitude spectrum
|
||||
halfN1 = floor(N1/2) + 1; % First half (real signal) [web:171]
|
||||
magX1_half = magX1(1:halfN1);
|
||||
f1 = (0:halfN1-1) * (Fs1/N1); % Frequency axis in Hz
|
||||
|
||||
figure('Name','Experiment 4 - Part i');
|
||||
plot(f1, magX1_half, 'g'); % Green magnitude spectrum
|
||||
xlabel('Frequency (Hz)');
|
||||
ylabel('|X_1(f)|');
|
||||
title('Experiment 4 - Part i : Magnitude spectrum of x(t)');
|
||||
grid on;
|
||||
|
||||
%% ========================== PART ii ==========================
|
||||
% ii) Set the sampling frequency to 5 kHz and time interval [0, 2 s]
|
||||
% x(t) = 0.1 sin(2000 * sqrt(t)) + 0.01 sin(4000 t) + 0.01 cos(7000 t)
|
||||
% Note: Interpret "2000 t1/2" as 2000 * sqrt(t), i.e., t^(1/2).
|
||||
|
||||
Fs2 = 5000; % Sampling frequency (Hz)
|
||||
Ts2 = 1 / Fs2; % Sampling period (s)
|
||||
t2 = 0 : Ts2 : 2; % Time vector (s)
|
||||
N2 = length(t2); % Number of samples
|
||||
|
||||
% Avoid sqrt(0) issues in instantaneous frequency by allowing t = 0 (OK in MATLAB)
|
||||
x2 = 0.1 * sin(2000 * sqrt(t2)) + 0.01 * sin(4000*t2) + 0.01 * cos(7000*t2);
|
||||
|
||||
% FFT and magnitude spectrum (single-sided)
|
||||
X2 = fft(x2);
|
||||
magX2 = abs(X2);
|
||||
halfN2 = floor(N2/2) + 1;
|
||||
magX2_half = magX2(1:halfN2);
|
||||
f2 = (0:halfN2-1) * (Fs2/N2); % Frequency axis in Hz
|
||||
|
||||
figure('Name','Experiment 4 - Part ii');
|
||||
plot(f2, magX2_half, 'g'); % Green magnitude spectrum
|
||||
xlabel('Frequency (Hz)');
|
||||
ylabel('|X_2(f)|');
|
||||
title('Experiment 4 - Part ii : Magnitude spectrum of x(t)');
|
||||
grid on;
|
||||
51
ISEN/Traitement du signal/CIPA4/TP/TP2/TP2_Experience5.m
Normal file
51
ISEN/Traitement du signal/CIPA4/TP/TP2/TP2_Experience5.m
Normal 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;
|
||||
37
ISEN/Traitement du signal/CIPA4/TP/TP2/TP2_Experience6.m
Normal file
37
ISEN/Traitement du signal/CIPA4/TP/TP2/TP2_Experience6.m
Normal 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;
|
||||
117
ISEN/Traitement du signal/CIPA4/TP/TP2/TP2_Experience7.m
Normal file
117
ISEN/Traitement du signal/CIPA4/TP/TP2/TP2_Experience7.m
Normal file
@@ -0,0 +1,117 @@
|
||||
%% Experiment 7 : Spectral Analysis of the raised cosine waveform
|
||||
% Raised cosine pulse:
|
||||
% h(t) = sinc(t/T) * cos(pi*beta*t/T) / (1 - (4*beta^2*t.^2)/T^2)
|
||||
% where sinc(x) = sin(pi*x)/(pi*x).
|
||||
%
|
||||
% For this experiment:
|
||||
% T = 2 ms
|
||||
% beta = 0.5 (then 0.25)
|
||||
% t in [-10T, 10T]
|
||||
% Ts = 0.13*T (sampling period)
|
||||
%
|
||||
% We generate the pulse h(t), plot it in time (ms) and frequency (Hz),
|
||||
% and compute the theoretical bandwidth B = (1/(2T))*(1+beta).
|
||||
|
||||
clc;
|
||||
clear;
|
||||
close all;
|
||||
|
||||
%% 1) 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
|
||||
|
||||
% Frequency axis for FFT (centered around 0)
|
||||
f_axis = (-N/2 : N/2-1) * (Fs / N); % Hz
|
||||
|
||||
% Inline handle to generate the pulse for any beta value
|
||||
rc_pulse = @(beta) arrayfun(@(tt) raisedCosineSample(tt, T, beta), t);
|
||||
|
||||
%% ===================== beta = 0.5 =====================
|
||||
|
||||
beta1 = 0.5;
|
||||
|
||||
% Time-domain pulse
|
||||
h1 = rc_pulse(beta1);
|
||||
|
||||
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)); % Magnitude, zero frequency centered
|
||||
|
||||
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;
|
||||
|
||||
% Theoretical bandwidth
|
||||
Rs = 1 / T; % Symbol rate (Hz)
|
||||
BW_theo1 = (Rs/2) * (1 + beta1); % B = (Rs/2)*(1+beta)
|
||||
fprintf('Theoretical bandwidth for beta = 0.5 : %.2f Hz\n', BW_theo1);
|
||||
|
||||
%% ===================== beta = 0.25 =====================
|
||||
|
||||
beta2 = 0.25;
|
||||
|
||||
% Time-domain pulse
|
||||
h2 = rc_pulse(beta2);
|
||||
|
||||
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;
|
||||
|
||||
% Theoretical bandwidth
|
||||
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)
|
||||
% with sinc(x) = sin(pi*x)/(pi*x).
|
||||
% Special cases at t = 0 and t = ±T/(2*beta) use limit values.
|
||||
x = t / T;
|
||||
|
||||
% Manual definition of sinc(x) = sin(pi*x)/(pi*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
|
||||
% At t -> 0, h(0) = 1 (sinc(0)=1 and cos(0)/(1-0)=1)
|
||||
h = 1;
|
||||
elseif beta ~= 0 && abs(abs(t) - T/(2*beta)) < 1e-12
|
||||
% Limit at t = ±T/(2*beta)
|
||||
h = (beta/pi) * sin(pi/(2*beta));
|
||||
else
|
||||
h = sx * cos(pi*beta*x) / (1 - (4*beta^2*x^2));
|
||||
end
|
||||
end
|
||||
Binary file not shown.
BIN
ISEN/Traitement du signal/CIPA4/TP/TP2/holiday_offer.mat
Normal file
BIN
ISEN/Traitement du signal/CIPA4/TP/TP2/holiday_offer.mat
Normal file
Binary file not shown.
Reference in New Issue
Block a user