Change frequency level after filter
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천

First grahp í the source data. After I filter it, I got the grahp 2. But as you can see, in the second grahp, the yelow line(I don't know how to call it) is not the same with the 0-0 line(blue). So I want to change the frequency level from 0,5 to 0. How can I do it.
Thanks in advance
채택된 답변
Star Strider
2015년 5월 14일
You seem to be using a low-pass filter. Use a bandpass filter instead, with a low-frequency cutoff that will eliminate the D-C offset (value at 0 Hz), and with the high-frequency cutoff you used in your original low-pass filter.
댓글 수: 8
How to change it. Could you please to explain more. I'm using code like this
filter(2,0.01,x)
Use the filter design functions in the Signal Processing Toolbox to design your filter. The filter you are using with that filter call is actually not doing any filtering.
For example, your filter has b=2, a=0.01 and freqz plots it as:
b = 2;
a = 0.01;
figure(1)
freqz(b, a, 512)
I do not have your signal, and I do not know what frequencies you want your filter to pass, so I cannot be specific about your bandpass filter design.
vu ngothanh
2015년 5월 14일
편집: vu ngothanh
2015년 5월 14일
here is a part of my input data
0.000000,6.200694E-6,-1.875651E-6
3.906250E-5,1.195134E-5,3.528527E-6
7.812500E-5,6.992699E-6,-1.703543E-6
0.000117,9.885240E-6,8.637580E-8
0.000156,7.302614E-6,2.633568E-6
0.000195,1.484388E-5,9.827665E-6
0.000234,9.781935E-6,1.359972E-6
0.000273,9.954110E-6,2.633568E-6
0.000312,1.470614E-5,2.977783E-6
0.000352,9.024364E-6,3.617479E-7
0.000391,8.852189E-6,-3.611039E-7
0.000430,8.886624E-6,-2.922609E-7
0.000469,1.050507E-5,7.418159E-6
0.000508,1.056979E-7,-1.302822E-5
0.000547,5.133209E-6,-9.689335E-6
0.000586,1.109046E-5,4.216958E-6
0.000625,2.688323E-6,-5.248959E-6
0.000664,6.786089E-6,-1.152799E-6
0.000703,4.926599E-6,-8.243631E-6
0.000742,6.889394E-6,-2.922609E-7
0.000781,5.064339E-6,-4.987900E-7
0.000820,7.130439E-6,-6.143919E-6
0.000859,2.102928E-6,-3.699991E-6
This is my code:
y=load('vibration_019.txt');
a=y(:,1);
c=y(:,3);
b=y(:,2);
figure(1);
subplot(2,1,1);
plot(a,b);
subplot(2,1,2);
[B,A]=butter(2,0.01);
b1=filter(B,A,b);
plot(a,b1);
Now, when I fix the code as you said. the result like this

But, I want like this:

What is the sampling frequency of your data?
Are:
a=y(:,1);
your sampling times?
vu ngothanh
2015년 5월 15일
편집: vu ngothanh
2015년 5월 15일
a=y(:,1); %time
b=(y:,2); %value at point 1
b=(y:,2); %value at point 2
There is not enough data to test the filter, but there is enough available to design it. I designed a bandpass filter with a lower frequency cutoff of 500 Hz and an upper frequency cutoff of 10 KHz. That should do what you want it to.
The code:
a = y(:,1);
b = y(:,2);
c = y(:,3);
%
Ts = mean(diff(a)); % Analyse Signal Spectrum
Fs = 1/Ts;
Fn = Fs/2;
fa = fft(a)/length(a);
fb = fft(b)/length(b);
Fv = linspace(0, 1, fix(length(fa)/2)+1)*Fn;
Iv = 1:length(Fv);
%
figure(1) % Plot Fourier Transformed Signals
subplot(2,1,1)
plot(Fv, abs(fa(Iv)))
grid
subplot(2,1,2)
plot(Fv, abs(fb(Iv)))
grid
%
Wp = [500 10000]/Fn; % Design Bandpass Filter
Ws = Wp.*[0.8 1/0.8];
Rp = 1;
Rs = 10;
[n,Wn] = buttord(Wp, Ws, Rp, Rs);
[b,a] = butter(n,Wn);
[sos,g] = tf2sos(b,a);
%
figure(2)
freqz(sos, 128, Fs) % Check Filter Performance
%
bfilt = filtfilt(sos, g, b); % Filter Signals
cfilt = filtfilt(sos, g, c);
%
figure(3) % Plot Filtered Signals
subplot(2,1,1)
plot(a, bfilt)
title('Velocity 1 Filtered')
grid
subplot(2,1,2)
plot(a, cfilt)
title('Velocity 2 Filtered')
grid
The documentation for the filter design is in the Signal Processing Toolbox documentation. It is relatively straightforward.
Thank you very much. I has just fix it as you say. it work. Thank you one more time
My pleasure!
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Modulation에 대해 자세히 알아보기
태그
참고 항목
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)
