MATLAB 高通滤波器回调函数 - high_pushbutton9_Callback
function high_pushbutton9_Callback(hObject, eventdata, handles) % hObject handle to high_pushbutton9 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) global x; global Fs; global tl; global x2;
x1=x;
% fp = 3000;
% fs = fp-300;
% Wp = 2fp/Fs;
% Ws = 2fs/Fs;
% if(Wp >= 1)
% Wp = 0.99;
% end
% if(Ws >= 1)
% Ws = 0.99;
% end
fp = get(handles.edit3,'string');
fp = str2double(fp)2;
if get(handles.radiobutton1,'value')
[n, Wn]=buttord(Wp,Ws, 2, 15);
[b, a]=butter(n, Wn,'high');
axes(handles.axes3);
[h,w]=freqz(b,a);
plot(w/piFs/2,abs(h));
x1=filter(b,a,x1); %璋冪敤鍑芥暟婊ゆ尝
elseif get(handles.radiobutton4,'value')
b2=fir1(30, fp/Fs,'high',boxcar(31));
axes(handles.axes3);
[h,w]=freqz(b2, 1,512);
plot(w/piFs/2,20log(abs(h)));
x1=fftfilt(b2,x1);
elseif get(handles.radiobutton5,'value')
b2=fir1(30, fp/Fs,'high', triang(31));
axes(handles.axes3);
[h,w]=freqz(b2, 1,512);
plot(w/piFs/2,20log(abs(h)));
x1=fftfilt(b2,x1);
elseif get(handles.radiobutton6,'value')
b2=fir1(30,fp/Fs,'high', hamming(31));
axes(handles.axes3);
[h,w]=freqz(b2, 1,512);
plot(w/piFs/2,20log(abs(h)));
x1=fftfilt(b2,x1);
elseif get(handles.radiobutton7,'value')
b2=fir1(30, fp/Fs, 'high',hanning(31));
axes(handles.axes3);
[h,w]=freqz(b2, 1,512);
plot(w/piFs/2,20log(abs(h)));
x1=fftfilt(b2,x1);
elseif get(handles.radiobutton8,'value')
b2=fir1(30, fp/Fs, 'high',blackman(31));
axes(handles.axes3);
[h,w]=freqz(b2, 1,512);
plot(w/piFs/2,20log(abs(h)));
x1=fftfilt(b2,x1);
elseif get(handles.radiobutton9,'value')
b2=fir1(30,fp/Fs,'high', kaiser(31));
axes(handles.axes3);
[h,w]=freqz(b2, 1,512);
plot(w/piFs/2,20log(abs(h)));
x1=fftfilt(b2,x1);
end;
axes(handles.axes5);
plot(tl,x1);
title('婊ら櫎鍣0鍚庤闊虫椂鍩熸尝褰?');
xlabel('鏃堕棿/s');
N=length(x1);
df=Fs/N;
w=[0:df:df*(N-1)] - Fs/2; %棰戠巼灏哄害
X=fft(x1);
X=fftshift(X);
axes(handles.axes6);
plot(w,abs(X)/max(abs(X)));
axis([-10000,10000,0,1]);
title('婊ら櫎鍣0鍚庤闊抽璋?');
xlabel('棰戠巼/Hz');
grid on;
x2=x1;
原文地址: https://www.cveoy.top/t/topic/nKfQ 著作权归作者所有。请勿转载和采集!