쪽팔리면 질문하지 맙시다. 소중한 답변 댓글을 삭제하는건 부끄러운 일 입니다
libfftw를 이용하여 주파수 분석을 하려는데
fftw_plan_dft_r2c_1d() 함수에
N개의 입력을 넣었다면
N/2 + 1 개의 출력이 나옵니다.
DFT에 의해서 N/2가 되는건 알겠는데 1은 어떤 정보가 나오는지 모르겠습니다.
혹시 +1의 신호가 어떤 것인지 참고할 만한 문서가 있을까요?
+
이미지 추가
딸 다섯 아들 하나 아빠 (큰 딸, 작은 딸, 왕큰 딸, 앵무새, 암 뭉뭉이, 수 뭉뭉이) - minimonk.net
Here, n is the ¡°logical¡± size of the DFT, not necessarily the physical size of the array. In particular, the real (double) array has n elements, while the complex (fftw_complex) array has n/2+1 elements (where the division is rounded down). For an in-place transform, in and out are aliased to the same array, which must be big enough to hold both; so, the real array would actually have 2*(n/2+1) elements, where the elements beyond the first n are unused padding. (Note that this is very different from the concept of ¡°zero-padding¡± a transform to a larger length, which changes the logical size of the DFT by actually adding new input data.) The kth element of the complex array is exactly the same as the kth element of the corresponding complex DFT. All positive n are supported; products of small factors are most efficient, but an O(n log n) algorithm is used even for prime sizes.
https://www.fftw.org/fftw3_doc/One_002dDimensional-DFTs-of-Real-Data.html#One_002dDimensional-DFTs-of-Real-Data
¹ø¿ªÀ» µ¹·ÁºÁµµ ¹«½¼ ¼Ò¸®ÀÎÁö ¸ð¸£°Ú½À´Ï´Ù
¾Æ¹«Æ° ½Ç¼ö(real number)¸¦ DFT Çϸé N/2+1·Î ³ª¿À´Âµ¥
0Àº ÀÌ»óÇÏ°Ô Å« °ªÀÌ Çϳª Æ¢¾î³ª¿À°í 1~N/2+1 ±îÁö °ªÀÌ ³ª¿À´Â °Í °°Àºµ¥
0ÀÌ FFT ¿¬»ê¿¡ ÀÇÇÑ °ªÀ̳Ä(Áï, 0Hz¿¡ ´ëÇÑ °è»ê °á°ú) ÀÌ·±°Ô ±Ã±ÝÇÕ´Ï´Ù.
ÀÏ´Ü r2c ÇÔ¼ö¿¡ r°ªÀ¸·Î 0~1 »çÀÌ·Î normalize Çߴµ¥µµ
dft °á°úÀÇ 0 ¹ø À妽º¿¡ 900,000 ±ÙóÀÇ °ªÀÌ µé¾î°¡´Â°É º¸¸é.. ¿øº» °ªÀ» ¸ð¸£´Âµ¥ ¾ò¾î°É¸° °ªÀÎÁö(¿øº» µ¥ÀÌÅÍ°¡ +-900,000 ¹üÀ§·Î ³ª¿È)
¾î¶»°Ô Çؼ®ÇØ¾ß ÇÒÁö ¸ð¸£°Ú½À´Ï´Ù.
(¿øº» µ¥ÀÌÅÍ°¡ +-900,000 ¹üÀ§·Î ³ª¿È) ÀÌ·±µ¥ 0 ¹ø À妽º¿¡ 900,000 ±ÙóÀÇ °ªÀÌ µé¾îÀÖ´Ù? ¹º°¡ ÀÌ»óÇѵ¥¿ä
À̹ÌÁö Ãß°¡Çߴµ¥ ¿øº» ½ÅÈ£´Â À§¿Í °°°í
¾Æ·¡´Â fftw ¶óÀ̺귯¸®·Î ó¸®ÇÑ °á°úÀÔ´Ï´Ù. 0¹ø° °ªÀÌ ÀÌ»óÇÏ´Ù°í »ý°¢Çؼ 0À¸·Î ó¸®Çß°í
fft ÀԷ°ªÀº 800,000 / 16777216(24bit) ·Î ³ª´©¾î¼ 0~1 »çÀÌÀÇ ½Ç¼ö·Î º¯È¯ÇÏ¿´½À´Ï´Ù.
±×·¯´Ï±î Ãâ·ÂÀÌ º¹¼Ò¼ö·Î ³ª¿À´Âµ¥
ai+b ¿¡¼
sqrt(a^2 + b^2) ·Î amplitude·Î º¯È¯ÇÑ´Ù°í Çؼ Çߴµ¥ ¼ö½ÄÀÌ ÀÌ»óÇÑ°ÇÁö °µµ°¡ 975,000 Á¤µµ·Î ³ª¿À³×¿ä
º¹¼Ò¼öÀÇ Å©±â °è»ê½ÄÀÌ À߸øµÇ¾ú´ÂÁö ´Ü°èº°·Î °ËÁõÇغÁ¾ß ÇÒ °Í °°½À´Ï´Ù ¤Ð¤Ð
http://www.ktword.co.kr/test/view/view.php?no=3725
õõÈ÷ Àоî´Â º¸°ÚÁö¸¸.. Àü±â/ÀüÀÚ Àü°øÀÌ ¾Æ´Ï¶ó ÀÌÇØÇϱ⠽±Áö°¡ ¾Ê³×¿ä ¤Ð¤Ð
stackoverflow
https://stackoverflow.com/questions/36637727/fftw-library-what-is-the-output-size-of-fftw-plan-dft-r2c-1d
http://www.fftw.org/fftw3_doc/
http://www.fftw.org/fftw3_doc/Real_002dto_002dReal-Transform-Kinds.html#Real_002dto_002dReal-Transform-Kinds
i0 is 0 because you're using real data , so it isn't stored in out.
stackoverlfow º¸¸é À§¿Í °°ÀÌ ½áÀִµ¥ ±×³É 1~N/2+1 ±îÁö ¾²¸é µÉ °Í °°³×¿ä
°¨»çÇÕ´Ï´Ù.
The 0 Hz component is in bin 0.
This is all covered in the FFTW manual.
¶ó´Â ¸»ÀÌ ÀÖ´Â °Å º¸´Ï +1 Àº DC ¼ººÐ À̳׿ä. Á¤È®È÷´Â 0 ¹ø° À妽º°ÚÁÒ.
"complex outputs for N real inputs" Ãâ·ÂÀÌ º¹¼Ò¼ö¶ó¼.
À§´ëÇϽÅ(?) chatGPT ´Ô²²¼´Â ¾Æ·¡ÀÇ ´ë´äÀ» ³»¾îÁּ̽À´Ï´Ù.
´Ù¸¸.. stackoverflow³ª À̰ųª.. ¹ø¿ªÇØÁ൵ ÀÌÇظ¦ ¸øÇÏ°Ú´Ù´Â°Ô ÇÔÁ¤À̳׿ä.
FFTW ¶óÀ̺귯¸®¿¡¼ Fast Fourier Transform (FFT)¸¦ Àû¿ëÇϸé, ±æÀÌ°¡ NÀÎ ½Ç¼ö ÀÔ·Â µ¥ÀÌÅÍ¿¡ ´ëÇØ º¹¼Ò¼ö Ãâ·Â µ¥ÀÌÅÍ N/2+1°³°¡ »ý¼ºµË´Ï´Ù. ÀÌ´Â FFT ¾Ë°í¸®ÁòÀÌ µ¿ÀÛÇÏ´Â ¹æ½Ä ¶§¹®ÀÔ´Ï´Ù.
FFTW¿¡¼ »ç¿ëµÇ´Â FFT ¾Ë°í¸®ÁòÀº "real-to-complex" FFT¶ó°í ºÒ¸®¸ç, ½Ç¼ö°ª ÀÔ·Â µ¥ÀÌÅ͸¦ º¹¼Ò¼ö°ª Ãâ·Â µ¥ÀÌÅÍ·Î º¯È¯ÇÕ´Ï´Ù. ÀÌ ¾Ë°í¸®ÁòÀº ½Ç¼ö°ª ½ÅÈ£ÀÇ Çª¸®¿¡ º¯È¯ÀÇ ´ëĪ¼º(symmetric) Ư¼ºÀ» È°¿ëÇÕ´Ï´Ù. ±¸Ã¼ÀûÀ¸·Î, ½Ç¼ö°ª ½ÅÈ£ x(t)ÀÇ Çª¸®¿¡ º¯È¯ X(f)Àº X(-f) = conj(X(f)) ¶ó´Â º¹¼Ò¼ö °ø¾×´ëĪ¼º(complex-conjugate symmetric)À» ¸¸Á·ÇÕ´Ï´Ù. ¿©±â¼ "conj"´Â º¹¼Ò¼ö °ø¾×(conjugate)¸¦ ÀǹÌÇÕ´Ï´Ù.
ÀÌ ´ëĪ¼º Ư¼º ¶§¹®¿¡ FFT ¾Ë°í¸®ÁòÀÇ Ãâ·Â°ª Áß Àý¹ÝÀº Áߺ¹µÇ´Â °ªÀ̸ç, ³ª¸ÓÁö Àý¹ÝÀº ÀÌ Áߺ¹µÈ °ªµé·ÎºÎÅÍ °è»êµÉ ¼ö ÀÖ½À´Ï´Ù. ±¸Ã¼ÀûÀ¸·Î, 0ºÎÅÍ N/2±îÁöÀÇ ÁÖÆļö ´ë¿ª¿¡¼´Â °íÀ¯ÇÑ Ãâ·Â°ªÀÌ Á¸ÀçÇϸç, N/2+1ºÎÅÍ N-1±îÁöÀÇ ÁÖÆļö ´ë¿ª¿¡¼´Â ´ëÀÀÇÏ´Â 1ºÎÅÍ N/2-1±îÁöÀÇ ÁÖÆļö ´ë¿ªÀÇ º¹¼Ò¼ö °ø¾×°ªÀ» °è»êÇÏ¿© ±¸ÇÒ ¼ö ÀÖ½À´Ï´Ù.
µû¶ó¼ FFTW´Â ¿¬»ê ½Ã°£°ú ¸Þ¸ð¸®¸¦ Àý¾àÇϱâ À§ÇØ, 0ºÎÅÍ N/2±îÁöÀÇ ÁÖÆļö ´ë¿ª¿¡ ´ëÇÑ °íÀ¯ÇÑ Ãâ·Â°ª°ú, NÀÌ Â¦¼öÀÎ °æ¿ì ÁÖÆļö N/2¿¡ ´ëÇÑ Ãâ·Â°ªÀ» °è»êÇÕ´Ï´Ù. ÀÌ·¸°Ô °è»êµÈ Ãâ·Â°ªÀÇ ÃÑ °³¼ö´Â N/2+1°³°¡ µË´Ï´Ù.
0Hz ¶ó°í Çϸé AC°¡ ¾Æ´Ñ DC ¼ººÐÀ¸·Î Àüü ½ÅÈ£°¡ ¸¸¾à +2000 ¸¸Å ¶°ÀÖ´Ù¸é 2000ÀÌ ±â·ÏµÇ´Â°É±î¿ä?
>>0Hz ¶ó°í Çϸé AC°¡ ¾Æ´Ñ DC ¼ººÐÀ¸·Î Àüü ½ÅÈ£°¡ ¸¸¾à +2000 ¸¸Å ¶°ÀÖ´Ù¸é 2000ÀÌ ±â·ÏµÇ´Â°É±î¿ä?
³×.
0 + N/2 ÁÖÆļö ´Ï±î ÃÑ N/2+1 °³À̸ç
0Hz¿¡´Â ½ÅÈ£ÀÇ DC ¼ººÐ(0Hz) ³»¿ëÀÌ ÀÖ´Ù°í ÀÌÇØÇϵµ·Ï ÇÏ°Ú½À´Ï´Ù.
°¨»çÇÕ´Ï´Ù!
³Ê¹« ¾î·Æ½À´Ï´Ù ¤Ð¤Ð
³ªÁß¿¡ ´Ù½Ã ÇÁ·Î±×·¥ ¼öÁ¤Çؼ µ¹·Áº¸°í ºÐ¼®Çؼ Ãß°¡±Û ¾²µµ·Ï Çغ¸°Ú½À´Ï´Ù.
°¨»çÇÕ´Ï´Ù
3Ãà Á¦¾î¸¦ ÇÏ¸ç ¹°¼º ÃøÁ¤ÇÏ´Â ¼ÒÇÁÆ®¿þ¾î¸¦ °³¹ßÇÑ ÀûÀÌ Àִµ¥ (¿©ÀüÈ÷ ¾÷±×·¹À̵åÇϸç ÆǸÅÁßÀÎ)
ÀÇ·Ú¸¦ ÁֽŠ´ëÇ¥´ÔÀÌ Àúº¸°í.. ¿Ø¸¸ÇÑ ÈÇаú ´ëÇпø»ýº¸´Ù ³µ´Ù°í ÇÏ´õ±º¿ä. ÃøÁ¤ ¹× ºÐ¼® ÅøÀ» ¸¸µå´Â °ÍÀε¥ ³»¿ëÀ» ÀÌÇØ ¸øÇϸé ÅøÀ» ¸¸µéÁö ¸øÇؼ..
Ç×»ó ´Ù¸¥ ºÐ¾ß¸¦ ÀÌÇØÇÏ°Ô ÇÏ´Â ¿ªÇÒÀ» °Á¦ ´çÇÏ´Â ´À³¦ÀÔ´Ï´Ù.
¾ÆÁ÷µµ ³¡³ªÁö ¾ÊÀº ·¹ÀÌÀú ºÐ±¤±â¶û, Áøµ¿ µ¥ÀÌÅÍ È¹µæ ÇÏ¿© ÁÖÆļö ºÐ¼®ÇÏ´Â °Í ±îÁö ÀÌÇØÇÏ·Á´Ï ¸Ó¸®°¡ ¾ÆÇÁ³×¿ä.
ÇΰèÀ̱ä Çѵ¥.. Àü»êÇÐ °è¿ Ãâ½ÅÀÌ¶ó ¿©±â ºÐµé ´ëºÎºÐÀÌ Àü±â/ÀüÀÚ Ãâ½ÅÀε¥
Á¤ÀÛ ¶óÀ̺귯¸® ½áº»»ç¶÷Àº ¾ø¾î¼ Á¦°¡ ¿½ÉÈ÷ ±¸¸£´Â ÁßÀÔ´Ï´Ù. µ¥±¸¸£¸£¸£¸£
+
°¥·Á³ª°¬À» ¹«¸íÀÇ ÈÇаú ´ëÇпø»ý¿¡°Ô ¹¬³äÀ»..
¿ØÁö Signal Processing À̶ó´Â ¿ø¼¸¦ Çϳª Á¤µ¶ÇÏ°í ÀÖÀ» ¹Ì·¡°¡ º¸ÀÔ´Ï´Ù. ÈåÈåÈå..
¸¸µé´Ù º¸´Ï À¥ ¿À½Ç·Î½ºÄÚÇÁ³×¿ä
ƯÁ¤ ÁÖÆļö¿¡¼ ÇÇÅ©°¡ Àß ¶ß³×¿ä. Á¤ÇöÆĸ¦ ³ÖÀ¸¸é Àú·¸°Ô ³ª¿ÀÁÒ.
¾î¶² °ªÀÎÁö ÀÌÇظ¦ ¸øÇؼ q/a¿¡ ¿Ã¸®°Ô µÇ¾ú³×¿ä
Àß Á¤±ÔÈ Çß´Ù¸é ÁÖÆļö°¡ ÀÖ´Â ºÎºÐÀÇ Å©±â°ªµµ 1À» ³ÑÁö ¾ÊÀ»ÅÙµ¥
ÀÏ´ÜÀº double ÇüÀÌ´Ù º¸´Ï amplitude¸¦ int ÇüÀ¸·Î Ç¥ÇöÇÏ·Á°í * 1000 ÇØµÐ°É ±î¸¶µæÀÌ ÀØ°í ÀÖ¾ú½À´Ï´Ù. ÇÏÇÏÇÏÇÏ ¤Ð¤Ð