Re: question relating to FFT [message #65371] |
Mon, 02 March 2009 15:30  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Paolo writes:
> Try plot,dist(152)
> Does that look like what you want?
It could be. Using the DIST function is one of the ways
you could construct a low-pass or high-pass filter for
digital images:
http://www.dfanning.com/ip_tips/freqfiltering.html
Cheers,
David
--
David Fanning, Ph.D.
Coyote's Guide to IDL Programming (www.dfanning.com)
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: question relating to FFT [message #65372 is a reply to message #65371] |
Mon, 02 March 2009 15:21   |
pgrigis
Messages: 436 Registered: September 2007
|
Senior Member |
|
|
Hu wrote:
> On Mar 2, 2:37 pm, Paolo <pgri...@gmail.com> wrote:
>> Hu wrote:
>>> Hi, there
>>> I try to use FFT function to smooth a curve (an array), and the code
>>> is like this:
>>
>>> FUNCTION FOURIER,ARRAY ;*****FAST FOURIER FLITER
>>> FILTER=1.0/(1.0+DIST(152)/4.0)^2
>>> newARRAY=FFT(FFT(ARRAY,-1)*FILTER,1)
>>> RETURN,newARRAY
>>> END
>>
>>> when I got an array X (has 152 elements) and use this function like :
>>
>>> Y = FOURIER(X)
>>
>>> I got an result Y with 152 elements, but all the elements are complex
>>> number, but How can I got an array filled with regular number, not
>>> complex number?
>>
>> To get real number,
>> you can take the REAL_PART or the ABS of your array.
>> But you are using a very strange filter indeed...
>>
>> Ciao,
>> Paolo
>>
>>
>>
>>> I mean, I want to use the result to calculate regression relationship
>>> with other array.
>>
>>
> Thank you ,and Why do you say it's strange? I want to denoise the
> whole curve( store as array) to make it more reasonable.
Try plot,dist(152)
Does that look like what you want?
Ciao,
Paolo
|
|
|
Re: question relating to FFT [message #65373 is a reply to message #65372] |
Mon, 02 March 2009 14:03   |
Hu
Messages: 35 Registered: January 2009
|
Member |
|
|
On Mar 2, 2:37 pm, Paolo <pgri...@gmail.com> wrote:
> Hu wrote:
>> Hi, there
>> I try to use FFT function to smooth a curve (an array), and the code
>> is like this:
>
>> FUNCTION FOURIER,ARRAY ;*****FAST FOURIER FLITER
>> FILTER=1.0/(1.0+DIST(152)/4.0)^2
>> newARRAY=FFT(FFT(ARRAY,-1)*FILTER,1)
>> RETURN,newARRAY
>> END
>
>> when I got an array X (has 152 elements) and use this function like :
>
>> Y = FOURIER(X)
>
>> I got an result Y with 152 elements, but all the elements are complex
>> number, but How can I got an array filled with regular number, not
>> complex number?
>
> To get real number,
> you can take the REAL_PART or the ABS of your array.
> But you are using a very strange filter indeed...
>
> Ciao,
> Paolo
>
>
>
>> I mean, I want to use the result to calculate regression relationship
>> with other array.
>
>
Thank you ,and Why do you say it's strange? I want to denoise the
whole curve( store as array) to make it more reasonable.
|
|
|
Re: question relating to FFT [message #65385 is a reply to message #65373] |
Mon, 02 March 2009 11:37   |
pgrigis
Messages: 436 Registered: September 2007
|
Senior Member |
|
|
Hu wrote:
> Hi, there
> I try to use FFT function to smooth a curve (an array), and the code
> is like this:
>
>
> FUNCTION FOURIER,ARRAY ;*****FAST FOURIER FLITER
> FILTER=1.0/(1.0+DIST(152)/4.0)^2
> newARRAY=FFT(FFT(ARRAY,-1)*FILTER,1)
> RETURN,newARRAY
> END
>
> when I got an array X (has 152 elements) and use this function like :
>
> Y = FOURIER(X)
>
> I got an result Y with 152 elements, but all the elements are complex
> number, but How can I got an array filled with regular number, not
> complex number?
To get real number,
you can take the REAL_PART or the ABS of your array.
But you are using a very strange filter indeed...
Ciao,
Paolo
>
> I mean, I want to use the result to calculate regression relationship
> with other array.
|
|
|
Re: question relating to FFT [message #65461 is a reply to message #65371] |
Tue, 03 March 2009 08:14  |
pgrigis
Messages: 436 Registered: September 2007
|
Senior Member |
|
|
David Fanning wrote:
> Paolo writes:
>
>> Try plot,dist(152)
>> Does that look like what you want?
>
> It could be. Using the DIST function is one of the ways
> you could construct a low-pass or high-pass filter for
> digital images:
>
> http://www.dfanning.com/ip_tips/freqfiltering.html
Yes, but the OP was speaking of a "curve" with 152 elements,
that is a one dimensional array. But dist(152) is a 152x152
array, and I don't think mixing 1-dim and 2-dim arrays like
that is the right way to go ;-)
It would be a bit easier to understand what is going on by
just building the 1-dim filter explicitely...
Ciao,
Paolo
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Coyote's Guide to IDL Programming (www.dfanning.com)
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|