calculate with Twiddle factor

조회 수: 20 (최근 30일)
Babis
Babis 2016년 2월 1일
답변: Pramita 2025년 1월 19일
Does anybody knows how to calculate the Twiddle Factors?
For example: for n=4 you have to do the calculate Wn= e^(-j*2*π)/n and ypu have to do it for a table 4x4. table looks like..
the second is the table after calculate the 4x4
and i need this for calculate twiddle factors for n=8,16,24...
  댓글 수: 2
Victor Cubedo
Victor Cubedo 2023년 12월 25일
cos(2pi*n*k/N)-j*sin(2pi*n*k/N) , N = 4,8,16, k and n = rows and colums
Victor Cubedo
Victor Cubedo 2023년 12월 25일
starting n and k in 0

댓글을 달려면 로그인하십시오.

답변 (2개)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023년 12월 25일
This is one of the possible solutions:
N = 4;
Twiddle_Factors = zeros(N, N);
for k = 0:N-1
for n = 0:N-1
Twiddle_Factors(k+1, n+1) = exp(-1i * 2 * pi / N * k * n);
end
end
disp('Twiddle Factors of size 4-by-4: ');
Twiddle Factors of size 4-by-4:
disp(Twiddle_Factors);
1.0000 + 0.0000i 1.0000 + 0.0000i 1.0000 + 0.0000i 1.0000 + 0.0000i 1.0000 + 0.0000i 0.0000 - 1.0000i -1.0000 - 0.0000i -0.0000 + 1.0000i 1.0000 + 0.0000i -1.0000 - 0.0000i 1.0000 + 0.0000i -1.0000 - 0.0000i 1.0000 + 0.0000i -0.0000 + 1.0000i -1.0000 - 0.0000i 0.0000 - 1.0000i

Pramita
Pramita 2025년 1월 19일
N = 8; % Number of points in DFT
w = zeros(1, N); % Pre-allocate array for twiddle factors
% Calculate the twiddle factors
for r = 0:N-1
w(r+1) = exp((-1j) * 2 * pi * r / N);
end
% Calculate Magnitude and Phase
Mag = abs(w);
Phase = (angle(w) / pi) * 180; % Convert phase to degrees
% Plotting
figure;
% Plot Magnitude
subplot(2,1,1);
stem(0:N-1, Mag, 'filled');
title('Magnitude of Twiddle Factors');
xlabel('Index');
ylabel('Magnitude');
grid on;
% Plot Phase
subplot(2,1,2);
stem(0:N-1, Phase, 'filled');
title('Phase of Twiddle Factors (degrees)');
xlabel('Index');
ylabel('Phase (degrees)');
grid on;
% Periodicity Check: W^(k+N) == W^k
k = 3; % Example index for periodicity check
disp(['Periodicity check: W^(', num2str(k), '+N) == W^(', num2str(k), '): ', num2str(w(k+1) == w(mod(k+N, N)+1))]);
Periodicity check: W^(3+N) == W^(3): 1
% Symmetry Check: W^(-k) == conj(W^k)
disp(['Symmetry check: W^(-', num2str(k), ') == conj(W^', num2str(k), '): ', num2str(w(mod(-k, N)+1) == conj(w(k+1)))]);
Symmetry check: W^(-3) == conj(W^3): 0

카테고리

Help CenterFile Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by