필터 지우기
필터 지우기

how can i get DTFS coefficients for cosine sequence and its power

조회 수: 8 (최근 30일)
Mostafa Anwar
Mostafa Anwar 2021년 6월 3일
답변: Sai Pavan 2024년 3월 26일
i know how to get it with dft in matlab but do i got it with dtfs ?

답변 (1개)

Sai Pavan
Sai Pavan 2024년 3월 26일
Hello Mostafa,
I understand that you want to get the Discrete Time Fourier Series (DTFS) coefficients of a cosine sequence and compute its power.
Given a cosine sequence, which is inherently periodic, we can directly compute its DTFS coefficients. The DTFS coefficients (a_k') of a periodic sequence (x[n]) with period (N) are given by:
for (n = 0, 1, ..., N-1).
Please refer to the below code snippet that illustrates the computation of DTFS coefficients and its power:
% Parameters
N = 100; % Number of samples
f = 1/20; % Frequency
% Generate the cosine sequence for one period
n = 0:N-1; % Time index
x = cos(2*pi*f*n); % Cosine sequence
% Compute DTFS coefficients
ak = zeros(1, N); % Preallocate array for coefficients
for k = 0:N-1
ak(k+1) = (1/N) * sum(x .* exp(-1j * 2 * pi * k * n / N));
end
% For the power, simply square the magnitude of the coefficients
power_ak = abs(ak).^2;
Hope it helps!

카테고리

Help CenterFile Exchange에서 Waveform Generation에 대해 자세히 알아보기

태그

제품


릴리스

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by