基于MATLAB的数字信号处理文档格式.docx
- 文档编号:19771857
- 上传时间:2023-01-10
- 格式:DOCX
- 页数:41
- 大小:392.91KB
基于MATLAB的数字信号处理文档格式.docx
《基于MATLAB的数字信号处理文档格式.docx》由会员分享,可在线阅读,更多相关《基于MATLAB的数字信号处理文档格式.docx(41页珍藏版)》请在冰豆网上搜索。
buttord、butter,cheb1ord、cheby1,cheb2ord、cheby2,ellipord、ellip。
五、程序代码(界面除外)及注释
functionvarargout=zuoye(varargin)
gui_Singleton=1;
gui_State=struct('
gui_Name'
mfilename,...
'
gui_Singleton'
gui_Singleton,...
gui_OpeningFcn'
@zuoye_OpeningFcn,...
gui_OutputFcn'
@zuoye_OutputFcn,...
gui_LayoutFcn'
[],...
gui_Callback'
[]);
ifnargin&
&
ischar(varargin{1})
gui_State.gui_Callback=str2func(varargin{1});
end
ifnargout
[varargout{1:
nargout}]=gui_mainfcn(gui_State,varargin{:
});
else
gui_mainfcn(gui_State,varargin{:
functionzuoye_OpeningFcn(hObject,eventdata,handles,varargin)
handles.output=hObject;
guidata(hObject,handles);
functionvarargout=zuoye_OutputFcn(hObject,eventdata,handles)
varargout{1}=handles.output;
functionedit1_show_Callback(hObject,eventdata,handles)
functionedit1_show_CreateFcn(hObject,eventdata,handles)
ifispc&
isequal(get(hObject,'
BackgroundColor'
),get(0,'
defaultUicontrolBackgroundColor'
))
set(hObject,'
'
white'
);
functionedit2_show_Callback(hObject,eventdata,handles)
functionedit2_show_CreateFcn(hObject,eventdata,handles)
functionnoise_radiobutton_Callback(hObject,eventdata,handles)
%------------信号产生部分--------------
functionsignal_popupmenu_Callback(hObject,eventdata,handles)
val=get(hObject,'
value'
globalf;
globalfs;
globalsin_1;
globalnoise_sin;
globalsquare_1;
globalnoise_square;
globalsawtooth_1;
globalnoise_sawtooth;
globalsound_1;
globalnoise_sound;
globaln;
n=0:
1/fs:
0.05;
%设定信号持续时间为0.05s
switchval
case1
ifget(handles.noise_radiobutton,'
)==get(handles.noise_radiobutton,'
max'
)
set(handles.edit2_show,'
string'
叠加噪声的正弦波'
FontSize'
12);
y=sin(2*pi*f*n);
noise_sin=y+rand(size(n));
axes(handles.axes2);
plot(n,noise_sin,'
linewidth'
1.5);
xlabel('
t/s'
gridon;
else
set(handles.edit1_show,'
正弦波波形'
sin_1=sin(2*pi*f*n);
axes(handles.axes1);
plot(n,sin_1,'
2);
end
case2
set(handles.edit2_show,'
叠加噪声的方波'
y=square(2*pi*f*n,50);
noise_square=y+rand(size(n));
plot(n,noise_square,'
方波波形'
square_1=square(2*pi*f*n,50);
plot(n,square_1,'
set(handles.axes1,'
Ylim'
[-1.5,1.5]);
case3
)
叠加噪声的三角波'
y=sawtooth(2*pi*f*n);
noise_sawtooth=y+rand(size(n));
plot(n,noise_sawtooth,'
set(handles.edit1_show,'
三角波波形'
sawtooth_1=sawtooth(2*pi*f*n);
plot(n,sawtooth_1,'
case4
叠加噪声的语音信号'
[y,fs1,bit]=wavread('
vo.wav'
y1=y(:
1);
%单声道处理
noise_sound=y1+rand(length(y1),1);
sound(noise_sound,fs1,bit);
N1=length(y1);
ts=(0:
N1-1)/fs1;
plot(ts,noise_sound);
语音信号'
sound_1=y(:
%单声道处理
sound(sound_1,fs1,bit);
N1=length(sound_1);
plot(ts,sound_1);
functionsignal_popupmenu_CreateFcn(hObject,eventdata,handles)
%----------信号变换-------------------
functiontransform_popupmenu_Callback(hObject,eventdata,handles)
globalN;
N=256;
%DFT,DCT变换的点数
k1=(1:
N).*fs/N;
val_signal=get(handles.signal_popupmenu,'
switchval_signal
switchval
叠加噪声的正弦信号DFT'
ifN>
length(noise_sin)
n=0:
N-1;
noise_sin=[noise_sin,zeros(1,N-length(noise_sin))];
k=0:
WN=exp(-j*2*pi/N);
nk=n'
*k;
WNnk=WN.^nk;
Xk=noise_sin*WNnk;
stem(k1,abs(Xk));
xlabel('
f/Hz'
set(handles.edit2_show,'
正弦信号的DFT'
length(sin_1)
sin_1=[sin_1,zeros(1,N-length(sin_1))];
Xk=sin_1*WNnk;
叠加噪声的正弦信号DCT'
Xk=dct(noise_sin);
stem(abs(Xk));
else
正弦信号的DCT'
Xk=dct(sin_1);
叠加噪声正弦信号的DWT'
[Xk1,Xk2]=dwt(noise_sin,'
db1'
plot(Xk1,'
--r'
holdon;
plot(Xk2,'
legend('
近似分量'
细节分量'
holdoff
正弦信号的DWT'
[Xk1,Xk2]=dwt(sin_1,'
叠加噪声的方波信号DFT'
length(noise_square)
noise_square=[noise_square,zeros(1,N-length(noise_square))];
end
Xk=noise_square*WNnk;
方波信号的DFT'
length(square_1)
square_1=[square_1,zeros(1,N-length(square_1))];
Xk=square_1*WNnk;
叠加噪声的方波信号DCT'
Xk=dct(noise_square);
方波信号的DCT'
Xk=dct(square_1);
叠加噪声的方波信号DWT'
[Xk1,Xk2]=dwt(noise_square,'
方波信号的DWT'
[Xk1,Xk2]=dwt(square_1,'
set(handles.edit1_show,'
叠加噪声的三角波DFT'
length(noise_sawtooth)
noise_sawtooth=[noise_sawtooth,zeros(1,N-length(noise_sawtooth))];
Xk=noise_sawtooth*WNnk;
三角波信号的DFT'
length(sawtooth_1)
sawtooth_1=[sawtooth_1,zeros(1,N-length(sawtooth_1))];
Xk=sawtooth_1*WNnk;
叠加噪声的三角波DCT'
Xk=dct(noise_sawtooth);
三角波信号的DCT'
Xk=dct(sawtooth_1);
)==get(handles.noise_radiobu
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 基于 MATLAB 数字信号 处理
![提示](https://static.bdocx.com/images/bang_tan.gif)