📄 fft.f90
字号:
Program fft
use fml
use fgl
implicit none
integer(4), parameter :: n = 1000, tmax = 10
type(mfArray) :: t, f, x1, x2, y1, y2
t = mfLinspace( 0, tmax, n )
f = mfLinspace( 0, n/tmax, n )
x1 = mfCos( t * 2d0 * MF_PI ) + mfSin( t * 2d0 * MF_PI * 1.746d0 + t ) + 0.2d0 * mfRand(1,n)
y1 = mfFFT(x1)
! remove the freq above 1.2
y2 = y1
call msAssign( mfS( y2, (tmax * 6 / 5).to.n ), 0 )
! do reverse
x2 = mfIFFT( y2 )
x2 = mfReal( x2 )
call msSubplot( 3, 1, 1 )
call msTitle('orig')
call msPlot( t, x1)
call msSubplot( 3, 1, 2 )
call msTitle('FFT')
call msPlot( f, mfAbs(y1) )
call msAxis( 0, 10, 0, 0 )
call msSubplot( 3, 1, 3 )
call msTitle('low pass with cutoff freq = 1.5')
call msPlot( t, x2 )
call msViewPause()
end Program fft
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -