이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
How to create Trignometric function lookup table
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi
I need help to create a lookup table for twiddle factor generated by trignometric cosine and sine function ?
Thanks
댓글 수: 12
Life is Wonderful
2021년 4월 16일
편집: Life is Wonderful
2021년 4월 19일
Thank you !
I was looking something like below code .
- Can you pls add further to improve say 1/4 quater radian lookup table and calculate all angles / radians ?
- What is best and efficient way for generating the lookup to get twiddle factor real and imaginary points ?
- How fft and ifft calculation can be improved here in case I use cordic sine and cosine lookup table ?
- cordiccosine and cordicsine Lookup table for N point FFT length ( say 1024,2048 upto 8192) ?
% Angle_rad = [-2*pi:1:2*pi];
close all;
clearvars;clc;
Angle_th = [0:1:360]; %
lookup_table = cos(Angle_th*2*pi/360); % replace cos with
% Replace current code here with pseudo
% What is the size of lookup table ? FFT length -1 , N = 1024, N*m-1 ( m
% =2,3,4 etc )
% cdcCosineTh = cordiccos(th_Rad_fix = [-2*pi :steps: 2*pi]);
% cdcsinTh = cordicsin(th_Rad_fix = [-2*pi :steps: 2*pi]);
% lookup_table[sizeof(FFT_Index)] = cordiccos(th_Rad_fix = [-2*pi :steps: 2*pi]) + -j*cordicsin(th_Rad_fix = [-2*pi :steps: 2*pi]);
% Which Radix 2/4/8/16/64/128/256 for odd and even is suggested and why ?
% How real and imaginary lookup table looks like
% Input real_lookup_cordiccos(angles[0:360])
% Input imag_lookup_cordicsin(angles[0:360])
% Accuracy ,performat and speed are determined by total harmonic
% distortion in -dBc i.e. SNR = rms( cordiccos & cordicsin -
% lookup_table_real & lookup_table_imag)
% It should work for iFFT and FFT implementation (reconstruct) without dC
% and capture fundamental and all harmonics for 2 octave onwards
% clf;
figure;
subplot(3,2,1);
plot(1:size(Angle_th,2),cos(Angle_th*2*pi/360),'g--','Linewidth', 1.5); hold on; grid on;
xlabel('\theta');
h1.XLim = [0, 2*pi];
h1.XTick =[0:22.5:360];
h1.XTickLabel = {'0', '45', '90','135' , '180' , '225' , '270' , '315' , '360'};
h1.YTick = -1:0.5:1;
h1.YTickLabel = {'-1.0','-0.5','0','0.5','1.0'};
title('Trignometric-Cosine-Lookup-table');
subplot(3,2,2);
plot(1:size(Angle_th,2),sin(Angle_th*2*pi/360),'r--','Linewidth', 1.5); hold on; grid on;
xlabel('\theta');
h1.XLim = [0, 2*pi];
h1.XTick =[0:22.5:360];
h1.XTickLabel = {'0', '45', '90','135' , '180' , '225' , '270' , '315' , '360'};
h1.YTick = -1:0.5:1;
h1.YTickLabel = {'-1.0','-0.5','0','0.5','1.0'};
title('Trignometric-sine-Lookup-table');
subplot(3,2,3);
radian = (pi/180)*Angle_th;
plot(Angle_th,radian,'r--'); hold on; grid on;
xlabel('\theta');ylabel('Radian');
subplot(3,2,4);
radian = (pi/180)*Angle_th;
plot(Angle_th,cos(radian),'r--'); hold on; grid on;
xlabel('\theta');ylabel('ARC');
subplot(3,2,5);
degree = (180/pi)*radian;
plot(radian,(degree),'b--'); hold on; grid on;
h1.YLim = [0, 360];
h1.YTick =[0:22.5:360];
h1.YTickLabel = {'0', '45', '90','135' , '180' , '225' , '270' , '315' , '360'};
ylabel('\theta');xlabel('Radian');
subplot(3,2,6);
degree = (180/pi)*radian;
plot(radian,cos(degree),'b--'); hold on; grid on;
ylabel('\theta');xlabel('Arc');
Walter Roberson
2021년 4월 16일
You do not seem to be using the Fixed Point Toolbox, but you seem to be wanting to implement fixed point operations ?
Life is Wonderful
2021년 4월 16일
That's right Walter. Initial preparation is done for floating point and next level take it to DSP :-)
The reason is to know the total harmonic distortion across the fltpt and fixpt
Walter Roberson
2021년 4월 16일
Write it using the fixed point toolbox. One of the options for fixed point toolbox use is to override the fixed point definitions with double precision for testing purposes. And you can test in fixed point on the host CPU anyhow.
Life is Wonderful
2021년 4월 16일
편집: Life is Wonderful
2021년 4월 16일
@Walter Roberson, can you please help me with some references for twiddle calculation using cordic cosine and cordic sine function?
I am assuming for calculation
twiddle(index) = cos(theta) + (1i*(sin(theta)));
Thank you!
Walter Roberson
2021년 4월 19일
I do not know about twiddle calculation for cordic, so I would have to research it.
Walter Roberson
2021년 4월 19일
Walter Roberson
2021년 4월 19일
You asked for references about twiddle factor computation; I linked to a reference about twiddle factor computation.
If you had asked for a MATLAB implementation then I probably would not have posted any links. I do not have source code for that purpose, and I do not have time to research the topic and write the code.
Life is Wonderful
2021년 4월 20일
편집: Life is Wonderful
2021년 4월 20일
I have some insight now . Folks have worked on this topic and there are advantage of using cordic algorithm for twiddle factor on DSP. May be MathWork documentation is poor and they should come up
With this I can write equation on a paper and start designing the code.
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Debugging and Analysis에 대해 자세히 알아보기
태그
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
아시아 태평양
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)