📄 continuous.m
字号:
function varargout = test(varargin)% TEST M-file for test.fig% TEST, by itself, creates a new TEST or raises the existing% singleton*.%% H = TEST returns the handle to a new TEST or the handle to% the existing singleton*.%% TEST('CALLBACK',hObject,eventData,handles,...) calls the local% function named CALLBACK in TEST.M with the given input arguments.%% TEST('Property','Value',...) creates a new TEST or raises the% existing singleton*. Starting from the left, property value pairs are% applied to the GUI before test_OpeningFunction gets called. An% unrecognized property name or invalid value makes property application% stop. All inputs are passed to test_OpeningFcn via varargin.%% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one% instance to run (singleton)".%% See also: GUIDE, GUIDATA, GUIHANDLES% Edit the above text to modify the response to help test% Last Modified by GUIDE v2.5 28-Apr-2007 23:26:08% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @test_OpeningFcn, ... 'gui_OutputFcn', @test_OutputFcn, ... 'gui_LayoutFcn', [] , ... 'gui_Callback', []);if nargin && ischar(varargin{1}) gui_State.gui_Callback = str2func(varargin{1});endif nargout [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});else gui_mainfcn(gui_State, varargin{:});end% End initialization code - DO NOT EDIT%图clf resetH=axes( 'unit' , 'normalized' , 'position' ,[0,0,1,1], 'visible' , 'off' );set(gcf, 'currentaxes' ,H);str= '\fontname{ mistral} 连续信号的卷积 ' ;text(0.12,0.93,str, 'fontsize' ,30);h_fig=get(H, 'parent' );set(h_fig, 'unit' , 'normalized' , 'position' ,[0.1,0.2,0.7,0.4]);h_axes=axes( 'parent' ,h_fig, ...'unit' , 'normalized' , 'position' ,[0.1,0.15,0.55,0.7], ...'xlim' ,[0 15], 'ylim' ,[0 1.8], 'fontsize' ,8); % 输入下限h_text=uicontrol(h_fig, 'style' , 'text' , ...'unit' , 'normalized' , 'position' ,[0.67,0.91,0.16,0.06], ...'horizontal' , 'left' , 'string' ,{ '系统信号 起始时间'},'fontsize' ,12);h_edit=uicontrol(h_fig, 'style' , 'edit' , ...'unit' , 'normalized' , 'position' ,[0.83,0.91,0.05,0.06],'fontsize' ,12, ...'horizontal' , 'left' , ...'callback' ,[ ...'l1=str2num(get(gcbo,''string''));' , ...'hold off,' ]); %上限h_text=uicontrol(h_fig, 'style' , 'text' , ...'unit' , 'normalized' , 'position' ,[0.75,0.85,0.10,0.06], ...'horizontal' , 'left' , 'string' ,{ '截止时间'},'fontsize' ,12);h_edit=uicontrol(h_fig, 'style' , 'edit' , ...'unit' , 'normalized' , 'position' ,[0.83,0.85,0.05,0.06],'fontsize' ,12, ...'horizontal' , 'left' , ...'callback' ,[ ...'l2=str2num(get(gcbo,''string''));' , ...'domain1=[l1:0.01:l2];',...'hold off,' ]); % 输入下限h_text=uicontrol(h_fig, 'style' , 'text' , ...'unit' , 'normalized' , 'position' ,[0.67,0.66,0.16,0.06], ...'horizontal' , 'left' , 'string' ,{ '系统信号 起始时间'},'fontsize' ,12);h_edit=uicontrol(h_fig, 'style' , 'edit' , ...'unit' , 'normalized' , 'position' ,[0.83,0.66,0.05,0.06],'fontsize' ,12, ...'horizontal' , 'left' , ...'callback' ,[ ...'l3=str2num(get(gcbo,''string''));' , ...'hold off,' ]); %下限h_text=uicontrol(h_fig, 'style' , 'text' , ...'unit' , 'normalized' , 'position' ,[0.75,0.60,0.10,0.06], ...'horizontal' , 'left' , 'string' ,{ '截止时间'},'fontsize' ,12);h_edit=uicontrol(h_fig, 'style' , 'edit' , ...'unit' , 'normalized' , 'position' ,[0.83,0.60,0.05,0.06],'fontsize' ,12, ...'horizontal' , 'left' , ...'callback' ,[ ...'l4=str2num(get(gcbo,''string''));' , ...'domain2=[l3:0.01:l4];',...'hold off,' ]); % h(t)=sinath_text=uicontrol(h_fig, 'style' , 'text' , ...'unit' , 'normalized' , 'position' ,[0.67,0.54,0.22,0.06], ...'horizontal' , 'left' , 'string' ,{ ' 设置系统h(t)=sin t'},'fontsize' ,12);%设置h(t)=sin?th_edit=uicontrol(h_fig, 'style' , 'edit' , ...'unit' , 'normalized' , 'position' ,[0.809,0.54,0.04,0.06], ...'horizontal' , 'left' ,'fontsize' ,12, ...'callback' ,[ ...'h=str2num(get(gcbo,''string''));']); %选择输入信号,下拉菜单方式h_text=uicontrol(h_fig, 'style' , 'text' , ...'unit' , 'normalized' , 'position' ,[0.67,0.75,0.18,0.06], ...'horizontal' , 'left' , 'string' ,{ '请选择输入信号的类型'},'fontsize' ,12);h_m=uicontrol(gcf,'style','popupmenu',... 'string',... '请选择|sin(t)|cos(t)|sin(t)+cos(t)|exp(-sin(t))',... 'position',[765 242 50 20],'callback' ,[... 't1=l1;', ... 't2=l2;', ... 't=[t1:0.01:t2];',... 'v=get(gcbo,''value'');',... 'switch v,',... 'case 2,',... 'x=sin(t);',... 'case 3,',... 'x=cos(t);,',... 'case 4,',... 'x=sin(t)+cos(t);,',... 'case 5,',... 'x=exp(-sin(t));,',... 'end' ]);%作x(t)的函数图像h_push1=uicontrol(h_fig, 'style' , 'push' , ...'unit' , 'normalized' , 'position' ,[0.77,0.14,0.1,0.1], ...'string' , '作x(t)' ,'fontsize' ,10, 'callback' ,[...'t=[l1:0.01:l2];',...'plot(t,x)',...]);%作h(t)的函数图像h_push1=uicontrol(h_fig, 'style' , 'push' , ...'unit' , 'normalized' , 'position' ,[0.67,0.14,0.1,0.1], ...'string' , '作h(t)' ,'fontsize' ,10, 'callback' ,[...'e=sin(h*domain2);', ...'plot(domain2,e)',...]);%作x(t)*h(t)的函数图像h_push1=uicontrol(h_fig, 'style' , 'push' , ...'unit' , 'normalized' , 'position' ,[0.87,0.14,0.1,0.1], ...'string' , '作x(t)*h(t)' ,'fontsize' ,10, 'callback' ,['n1=min(domain1)+min(domain2);',...'n2=max(domain1)+max(domain2);',...'n=[n1:0.01:n2];', ...'e=sin(h*domain2);', ...'zq=conv(e,x);',...'plot(n,zq);',...'hold off,' ]); %BUG声明h_text=uicontrol(h_fig, 'style' , 'text' , ...'unit' , 'normalized' , 'position' ,[0.67,0.25,0.18,0.27], ...'horizontal' , 'left' , 'string' ,{ '程序存在BUG,每次算卷积都要重新输入数据,包括以上所有信息'},'fontsize' ,12);%系统声明h_text=uicontrol(h_fig, 'style' , 'text' , ...'unit' , 'normalized' , 'position' ,[0.87,0.25,0.10,0.27], ...'horizontal' , 'left' , 'string' ,{ '系统为sin(a*t),请输入其时间段'},'fontsize' ,12);%开启网格h_push1=uicontrol(h_fig, 'style' , 'push' , ...'unit' , 'normalized' , 'position' ,[0.67,0.03,0.1,0.1], ...'string' , '开启网格' ,'fontsize' ,10, 'callback' , 'grid on' );%关闭网格h_push2=uicontrol(h_fig, 'style' , 'push' , ...'unit' , 'normalized' , 'position' ,[0.77,0.03,0.1,0.1], ...'string' , '关闭网格' , 'fontsize' ,10, 'callback' , 'grid off' ); %====================================% The CLOSE buttonh_push3=uicontrol(h_fig, 'style' , 'push' , ...'unit' , 'normalized' , 'position' ,[0.87,0.03,0.1,0.1], ...'string' , '关闭界面' ,'fontsize' ,10, 'callback' ,'close(gcbf)' );% --- Executes just before test is made visible.function test_OpeningFcn(hObject, eventdata, handles, varargin)% This function has no output args, see OutputFcn.% hObject handle to figure% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% varargin command line arguments to test (see VARARGIN)% Choose default command line output for testhandles.output = hObject;% Update handles structureguidata(hObject, handles);% UIWAIT makes test wait for user response (see UIRESUME)% uiwait(handles.figure1);% --- Outputs from this function are returned to the command line.function varargout = test_OutputFcn(hObject, eventdata, handles) % varargout cell array for returning output args (see VARARGOUT);% hObject handle to figure% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Get default command line output from handles structurevarargout{1} = handles.output;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -