[英]Applying bandpass in the Fourier for my signal in matlab
I'm trying to apply a bandpass around freq 0 without luck. 我正在尝试在频率0附近应用带通,但没有运气。 I'd be happy to receive some help please
我很乐意得到帮助
x=scan11(1,:)*1e-3/3e8; y=scan11(2,:);
plot(x,y) % my function
[XX,ff]=trans_fourier(y,mean(diff(x)));
plot(ff,abs(XX)) % gives the Fourier transform
I want to choose the freq around 0. let's suppose -1e13 till 1e13 and than to make ifft and to plot the signal after this filer. 我想在0附近选择频率。让我们假设-1e13到1e13,然后进行ifft并在此文件管理器之后绘制信号。
How should I start doing this? 我应该如何开始呢? the command
命令
YY=bandpass(y,[-1e13 1e13],1/mean(diff(x)))
didn't help here unfortunately. 不幸的是,这里没有帮助。
Since, i can't upload here files, here is also my question on matlab forum with all the files 由于我无法在此处上传文件,这也是我在Matlab论坛上与所有文件有关的问题
I am not sure what the contents of the trans_fourier function exactly are, but in 'plain matlab functions', you could attempt something along the lines of the following. 我不确定trans_fourier函数的内容到底是什么,但是在“普通matlab函数”中,您可以按照以下方式尝试一些操作。
Nt = 1024; % Number of samples
Fs = 10; % Sampling frequency (samples / second)
t = (0:Nt-1)/Fs; % Time array
x = sin(t/10); % Low-frequency signal
x = x + 0.25*randn(1,Nt); % add some noise
X = fftshift(fft(x)); % FFT of signal with 0 Hz centered
fr = (-Nt/2 : Nt/2-1)/(Nt/Fs); % Frequency axis
% Filter: squared cosine (edit as desired)
fsl = 10; % Length of filter slope, in samples
filt = zeros(size(X));
filt(Nt/2+1+(-fsl:fsl)) = cos( linspace(-pi/2,pi/2,2*fsl+1) ).^2;
x_filt = real(ifft(ifftshift( filt.*X ))); % Filtered x
figure();
subplot(2,2,1); plot(t,x); ax=axis; title('original signal');
subplot(2,2,4); plot(t,x_filt); axis(ax); title('Low-pass filtered signal');
subplot(2,2,2); plot(fr,abs(X)); ax=axis; title('original amplitude spectrum');
subplot(2,2,3); plot(fr,abs(X).*filt); axis(ax); title('Filtered amplitude spectrum');
I am not sure what exactly you meant when you said 我不确定你说的是什么意思
let's suppose -1e13 till 1e13
假设-1e13至1e13
, but keep in mind that extracting a single fourier component (essentially setting all values of the spectrum to zero, except the one you are interested in) acts as a brick-wall filter, and you will get considerable artefacts if you take the inverse transform. ,但是请记住,提取单个傅立叶分量(基本上将频谱中的所有值设置为零,除了您感兴趣的那个值之外)都可以用作砖墙过滤器,并且如果进行逆变换,将会得到相当大的伪像。 。 Refer to this topic or this page if you're interested.
如果有兴趣,请参考本主题或本页 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.