matlab滤波器与均衡器设计方案.docx
- 文档编号:23866520
- 上传时间:2023-05-21
- 格式:DOCX
- 页数:10
- 大小:17.93KB
matlab滤波器与均衡器设计方案.docx
《matlab滤波器与均衡器设计方案.docx》由会员分享,可在线阅读,更多相关《matlab滤波器与均衡器设计方案.docx(10页珍藏版)》请在冰豆网上搜索。
matlab滤波器与均衡器设计方案
封面
作者:
PanHongliang
仅供个人学习
Digitalsignalandanalysis
Title:
Afilterandequilizer
Name:
Yangxiao
Class:
Masterofmechanicalengineering1302
StudentID:
M201370503
Abstract:
Designingsomekindsoffiltersbyusingmatlab.Wecanunderstandthesignalprocessingoffiltermorecomprehensivebyanalyzingthefilteringpropertiesofdifferentfilters.Designinganadjustableparameterofdigitalfilterwhichiscalledequalizer.Inthispaper,thedigitalequalizerwhichisbasedonMATLABplatformdesigninghasthefunctionsofaccessingWavfile,filteringandplaying.
Keyword:
Matlab,Filter,Equalizer
1.Preface
MATLABiscalledMatrixLaboratory,whichisdesignedbytheUnitedStatesMathWorkscompany.It’sacommercialmathematicalsoftware.MatlabcanbeuseforMatrixoperations,mappingfunctionsanddata,algorithm,creatingtheuserinterface,connecttootherprogramminglanguagesprocedures,mainlyusedinengineeringcalculations,controldesign,signalprocessingandcommunications,imageprocessing,signaldetection,designandfinancialmodelinganalysisandotherfields.GUI(GraphicalUserInterface,referredtoasGUI,knownGraphicalUserInterface)isdisplayedusingthegraphicaluserinterfaceofcomputeroperations..MatlabhasapowerfulGUltool.Inthisreport,byusingmatlabGUItoolwecoulddesignasignalfilterandequalizer.
ThefilterCanbedividedintolow-pass,high-passfilter,bandpassandband-stopfilter.Low-passfilter:
itallowssignalinlowfrequencyordccomponentthrough,suppressthehighfrequencycomponentortheinterferenceandnoise.High-passfilter:
itallowsthesignalinhighfrequency,restrainlowfrequencyordccomponent.Band-passfilter:
itallowsaspectrumofsignalthroughandrestrainthesignalbeloworabovethespectrum,interferenceandnoise.Band-stopfilter:
itinhibitthesignalwithinacertainfrequencybandandpassthesignaloutsidethespectrum.
2.Introduce
Thefilterwhichisdesignedbyusingmatlabhavefourfunctions:
low-pass,high-pass,band-stopandband-pass.Everyfunctioncouldinputthecut-offfrequencies.Theequalizercouldfilterthewavfileinputtedaswewant.
Theinterfaceisthat:
2.1Interface
3.DesignPrinciples
Thetaskistodesignthefilterandequalizerwhichcanedittheinputtingsignalaswewantandchoosethefrequencyspectrumtopass.
3.1thestandardsignalinput
Wedesignasignalgeneratorwhichisusedtogeneratorstandardwaveformsuchassin,square,triangular,sawtoothandnoise.Andwecandecidewhetheraddingdifferentwaves.Theprogramis:
Fs=10000;
N=400;
x=linspace(0,N/Fs,N);
t=get(handles.WaveMake,'Value');
f=str2double(get(handles.frequency,'String'));
a=str2double(get(handles.amplitude,'String'));
p=0;
switcht
case1
y=a*sin(2*pi*x*f+p);
ifget(handles.add,'Value')==0.0
handles.y=y;
else
handles.y=handles.y+y;
end
case2
......
case5
y=a*(2*rand(size(x))-1);
ifget(handles.add,'Value')==0.0
handles.y=y;
else
handles.y=handles.y+y;
end
end
handles.inputtype=3;
guidata(hObject,handles);
plot(handles.axes1,handles.y);
xlim([0200]);
temple=handles.y;
f=linspace(0,Fs/2,N/2);
P=2*fft(temple,N)/N;
Pyy=sqrt(P.*conj(P));
plot(handles.axes2,f,Pyy(1:
N/2));
Theinterfaceis:
3.1theimageofwaveform
3.2thewavefiltering
Bychoosingtheworkingmodeoffilterandinputcut-offfrequencieswecanrealizethefiltering.Theprogramis:
y=handles.y;
FC=str2double(get(handles.hf,'string'));
Fs=22000;
n=44100;
N=8;
Wn=FC/(Fs/2);
%thelow-passprogram
[b,a]=butter(N,Wn,'low');
z=filter(b,a,y);
P=fft(z,n);
f=linspace(0,Fs/2,n/2);
Pyy=2*sqrt(P.*conj(P))/n;
plot(handles.axes3,z);
plot(handles.axes4,f,Pyy(1:
n/2));
handles.z=z;
guidata(hObject,handles);
Byrunningtheprogramwecanrealizelow-passfilter
3.2theimageoflow-passfilter
Thehigh-passprogramis:
[b,a]=butter(N,Wn,'high');
z=filter(b,a,y);
P=fft(z,n);
f=linspace(0,Fs/2,n/2);
Pyy=2*sqrt(P.*conj(P))/n;
plot(handles.axes3,z);
plot(handles.axes4,f,Pyy(1:
n/2));
handles.z=z;
guidata(hObject,handles);
Byrunningtheprogramwecanrealizehigh-passfilter
3.3theimageofhigh-passfilter
Theband-stopprogramis:
[b,a]=butter(N,Wn,'stop');
z=filter(b,a,y);
P=fft(z,n);
f=linspace(0,Fs/2,n/2);
Pyy=2*sqrt(P.*conj(P))/n;
plot(handles.axes3,z);
plot(handles.axes4,f,Pyy(1:
n/2));
handles.z=z;
guidata(hObject,handles);
Byrunningtheprogramwecanrealizeband-stopfilter
3.4theimageofband-stopfilter
Theband-passprogramis:
[b,a]=butter(N,Wn,'bandpass');
z=filter(b,a,y);
P=fft(z,n);
f=linspace(0,Fs/2,n/2);
handles.Pyy=2*sqrt(P.*conj(P))/n;
plot(handles.axes3,z);
plot(handles.axes4,f,handles.Pyy(1:
n/2));
handles.z=z;
guidata(hObject,handles);
Byrunningtheprogramwecanrealizeband-passfilter
3.5theimageofband-passfilter
3.3theequalizerfiltering
Wecanopenawavfilebyrunthisprogram:
[filename,pathname]=uigetfile('*.wav','selectawavfile');
ifisequal(filename,0)
disp('theusercancelstoselect');
else
str=strcat(pathname,filename);
disp(strcat('theuserselect',str));
set(handles.filename,'string',str);
end
[y,Fs,bits]=wavread(str);
handles.y=y;
handles.z=y;
guidata(hObject,handles);
Whenwechooseawavfile,wecanrealizeequalizerfilterbysettingthevaluesofThescrollbarsandruntheprogram:
handles.a=handles.y(:
1);
y=handles.a;
l=length(y);
Fs=44100;
%t=(0:
l-1)/Fs;
Y=zeros(size(y));
A1=get(handles.slider1,'value');
[b,a]=butter(2,[30/(Fs/2),60/(Fs/2)],'bandpass');
Y=Y+2*A1*filter(b,a,y);
A2=get(handles.slider2,'value');
[b,a]=butter(2,[60/(Fs/2),100/(Fs/2)],'bandpass');
Y=Y+2*A2*filter(b,a,y);
A3=get(handles.slider3,'value');
[b,a]=butter(2,[100/(Fs/2),200/(Fs/2)],'bandpass');
Y=Y+2*A3*filter(b,a,y);
A4=get(handles.slider4,'value');
[b,a]=butter(2,[200/(Fs/2),500/(Fs/2)],'bandpass');
Y=Y+2*A4*filter(b,a,y);
A5=get(handles.slider5,'value');
[b,a]=butter(2,[500/(Fs/2),1000/(Fs/2)],'bandpass');
Y=Y+2*A5*filter(b,a,y);
A6=get(handles.slider6,'value');
[b,a]=butter(2,[1000/(Fs/2),2000/(Fs/2)],'bandpass');
Y=Y+2*A6*filter(b,a,y);
A7=get(handles.slider7,'value');
[b,a]=butter(2,[2000/(Fs/2),4000/(Fs/2)],'bandpass');
Y=Y+2*A7*filter(b,a,y);
A8=get(handles.slider8,'value');
[b,a]=butter(2,[4000/(Fs/2),8000/(Fs/2)],'bandpass');
Y=Y+2*A8*filter(b,a,y);
z=Y;
Fs=44100;
ysize=size(handles.y);
N=str2double(num2str(ysize
(1)));
wavplay(z,Fs);
P=fft(y,N);
Pyy1=2*sqrt(P.*conj(P))/N;
P=fft(z,N);
Pyy=2*sqrt(P.*conj(P))/N;
f=linspace(0,Fs/2,N/2);
%Originalwave
time=(1:
length(y))/Fs;
plot(handles.axes1,time,y);
%Originalfrequency
plot(handles.axes2,f,Pyy1(1:
N/2));
%Theequilizerwave
plot(handles.axes3,time,z);
%Theequilizerfrequency
plot(handles.axes4,f,Pyy(1:
N/2));
guidata(hObject,handles);
Theinterfaceis:
3.6theimageofequalizer
Wecanseetheequalizerrealizethefunctionoffrequencyfilteringwell.
4.Existproblem
Theinterfacesarenotenoughbeautiful
Theequlizercann'trealizePause,fastforward,andsoon.
Thespectrumofmusiccannotbeupdatedinrealtime.
5.Conclusion
Withthecomplementofthethirdproject,thewholeprojectsinthecoursehavebeenfinished.FromthebeginningwhenIdon’tknowthecontentaswellasthesoftmatlabverymuch,intheendwhenIhavecompletealltheprojectswiththematlab,itisreallynoteasy.
ThereisnoneedtosaythatIcanmakeasimplesystemwiththesoftmatlabnow.Thelastone,thefilterandequalizeristhecombinationoftheknowledgethatisobtainedfromthedesigningthefirsttwoprojects.
Withthebasisofknowledgeinthecourseaswellasmatlab,Iwillnotbeafraidoftheproblem.Nothingisimpossibletoawillingmind.Ifwemakeupourmindstodoathing,wewillsolvealltheproblemsinthelast.
References
[1]薛山.MATLAB基础教程.[M]北京:
清华大学出版社,2011.3
版权申明
本文部分内容,包括文字、图片、以及设计等在网上搜集整理。
版权为潘宏亮个人所有
Thisarticleincludessomeparts,includingtext,pictures,anddesign.CopyrightisPanHongliang'spersonalownership.
用户可将本文的内容或服务用于个人学习、研究或欣赏,以及其他非商业性或非盈利性用途,但同时应遵守著作权法及其他相关法律的规定,不得侵犯本网站及相关权利人的合法权利。
除此以外,将本文任何内容或服务用于其他用途时,须征得本人及相关权利人的书面许可,并支付报酬。
Usersmayusethecontentsorservicesofthisarticleforpersonalstudy,researchorappreciation,andothernon-commercialornon-profitpurposes,butatthesametime,theyshallabidebytheprovisionsofcopyrightlawandotherrelevantlaws,andshallnotinfringeuponthelegitimaterightsofthiswebsiteanditsrelevantobligees.Inaddition,whenanycontentorserviceofthisarticleisusedforotherpurposes,writtenpermissionandremunerationshallbeobtainedfromthepersonconcernedandtherelevantobligee.
转载或引用本文内容必须是以新闻性或资料性公共免费信息为使用目的的合理、善意引用,不得对本文内容原意进行曲解、修改,并自负版权等法律责任。
Reproductionorquotationofthecontentofthisarticlemustbereasonableandgood-faithcitationfortheuseofnewsorinformativepublicfreeinformation.Itshallnotmisinterpretormodifytheoriginalintentionofthecontentofthisarticle,andshallbearlegalliabilitysuchascopyright.
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- matlab 滤波器 均衡器 设计方案