Demonstration of Fourier series in continuous time signal

バージョン 1.0.0 (273 KB) 作成者: SRIHARANI
The Fourier series is a powerful mathematical tool used to represent periodic functions as a sum of sinusoidal functions.
ダウンロード: 3
更新 2024/4/24

ライセンスの表示

Signal processing applications can demonstrate the Fourier series of continuous time signal in application such as audio signal processing.
Music and sound synthesis explore the application of Fourier series in music and sound synthesis.
Real world signal analysis apply Fourier signal such as biomedical signals (EEG,ECG)
% Parameters
T = 1; % Period of the signal
fs = 1000; % Sampling frequency
t = 0:1/fs:5*T; % Time vector
% Generate a continuous-time signal
x = sawtooth(2*pi*t/T); % Sawtooth wave with period T
% Compute the Fourier series coefficients
N = 20; % Number of harmonics
a0 = mean(x); % DC component
an = zeros(1, N); % Initialize array for cosine coefficients
bn = zeros(1, N); % Initialize array for sine coefficients
for n = 1:N
an(n) = 2/T * trapz(t, x.*cos(2*pi*n*t/T)); % Cosine coefficient
bn(n) = 2/T * trapz(t, x.*sin(2*pi*n*t/T)); % Sine coefficient
end
% Reconstruct the signal using the Fourier series
x_hat = a0/2;
for n = 1:N
x_hat = x_hat + an(n)*cos(2*pi*n*t/T) + bn(n)*sin(2*pi*n*t/T);
end
% Plot the original signal and reconstructed signal
figure;
subplot(2,1,1);
plot(t, x);
title('Original Signal');
xlabel('Time');
ylabel('Amplitude');
subplot(2,1,2);
plot(t, x_hat);
title('Reconstructed Signal using Fourier Series');
xlabel('Time');
ylabel('Amplitude');

引用

SRIHARANI (2024). Demonstration of Fourier series in continuous time signal (https://www.mathworks.com/matlabcentral/fileexchange/164326-demonstration-of-fourier-series-in-continuous-time-signal), MATLAB Central File Exchange. 取得済み .

MATLAB リリースの互換性
作成: R2024a
すべてのリリースと互換性あり
プラットフォームの互換性
Windows macOS Linux
謝辞

ヒントを得たファイル: Fourier series of real signals

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
バージョン 公開済み リリース ノート
1.0.0