资源简介
学习matlab gui编程入门,完成一个基于GUIDE的图形化界面程序,结合信号生成及分析等。
学习matlab gui编程入门,完成一个基于GUIDE的图形化界面程序,结合信号生成及分析等。
学习matlab gui编程入门,完成一个基于GUIDE的图形化界面程序,结合信号生成及分析等。
代码片段和文件信息
function varargout = signal_generator(varargin)
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct(‘gui_Name‘ mfilename ...
‘gui_Singleton‘ gui_Singleton ...
‘gui_OpeningFcn‘ @signal_generator_OpeningFcn ...
‘gui_OutputFcn‘ @signal_generator_OutputFcn ...
‘gui_LayoutFcn‘ [] ...
‘gui_Callback‘ []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State varargin{:});
else
gui_mainfcn(gui_State varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before signal_generator is made visible.
function signal_generator_OpeningFcn(hobject eventdata handles varargin)
handles.output = hobject;
global t;
global run;
% text windos init
set(handles.fre_text‘string‘get(handles.fre_slider‘value‘));
set(handles.amp_text‘string‘get(handles.amp_slider‘value‘));
% x axes data
%handles.x = linspace(00.03441*3);
handles.x = linspace(01.544100*1.5);
% wave shape data
handles.shape = 2;
% data init
t = 0;
run = 0;
handles
guidata(hobject handles);
% --- Outputs from this function are returned to the command line.
function varargout = signal_generator_OutputFcn(hobject eventdata handles)
varargout{1} = handles.output;
function my_callback(handles)
global sound_y;
global plot_y;
global plot_x;
global t;
x = handles.x;
fre = get(handles.fre_slider‘value‘);
amp = get(handles.amp_slider‘value‘);
% white noise
if handles.shape == 1
sound_y = 0.5*amp*wgn(144100*1.51);
% sin singal
elseif handles.shape == 2
sound_y = amp*sin(2*pi*fre*x);
% square singal
elseif handles.shape == 3
sound_y = amp*square(2*pi*fre*x);
% trangle singal
elseif handles.shape == 4
sound_y = amp*sawtooth(2*pi*fre*x0.5);
end
plot_x = x(:(1+t):(3*441+t));
plot_y = sound_y(:(1+t):(3*441+t));
plot(handles.monitorplot_xplot_y);
set(handles.monitor‘ylimmode‘‘manual‘);
set(handles.monitor‘ylim‘[-20002000]);
% get peak value
peak_max = max(plot_y);
peak_min = min(plot_y);
peak_value = peak_max - peak_min;
set(handles.peak‘string‘num2str(peak_value));
% get mean value
mean_value = mean(plot_y);
set(handles.mean‘string‘num2str(mean_value));
% get rms value
rms_value = rms(plot_y);
set(handles.rms‘string‘num2str(rms_value));
% % get frequency value
% fre_value = fft(plot_y);
% aaa = abs(fre_value);
% [mp] = max(aaa);
% set(handles.std‘string‘num2str(p));
% get std error value
std_value = std(plot_y);
set(handles.std‘string‘num2str(std_value));
% --- Executes on button press in noise.
function noise_Callback(hobject eventdata handles)
handles.shape = 1;
guidata(hobject handles);
my_callback(handles);
% --- Executes on button press in square.
function square_Callback(hobject eventdata handles)
handles.shape = 3;
guidata(hobject handles);
my_callback(handles);
% --- Executes on button pre
- 上一篇:1/4悬架模型
- 下一篇:三次样条算法MATLAB程序
相关资源
- Pattern Recognition and Machine Learning(高清
- MATLAB 编程 第二版 Stephen J. Chapman 著
- 均值滤波和FFT频谱分析Matlab代码
- 《MATLAB扩展编程》代码
- HDB3码、AMI码的MATLAB实现
- 3点GPS定位MATLAB仿真
- MATLAB数字信号处理85个实用案例精讲入
- matlab从入门到精通pdf94795
- 欧拉放大论文及matlab代码
- 跳一跳辅助_matlab版本
- 全面详解LTE MATLAB建模、仿真与实现
- MIMO-OFDM无线通信技术及MATLAB实现_孙锴
- MATLAB Programming for Engineers 4th - Chapman
- matlab 各种谱分析对比
- 分数阶chen混沌matlab程序
- 基于粒子群算法的非合作博弈的matl
- MATLAB车流仿真 包括跟驰、延误
- matlab空间桁架计算程序
- 基于MATLAB的图像特征点匹配和筛选
- DMA-TVP-FAVAR
- GPS信号的码捕获matlab代码.7z
- 一维光子晶体MATLAB仿真代码吸收率折
- newmark法源程序
- 传统关联成像、计算鬼成像matlab
- pri传统分选算法
- 摆动滚子推杆盘形凸轮设计
- 医学图像重建作业matlab源码
- Matlab实现混沌系统的控制
- 检测疲劳驾驶
- Matlab锁相环仿真-Phase Locked Loop.rar
评论
共有 条评论