📄 juanji2.m
字号:
function varargout = juanji2(varargin)% JUANJI2 Application M-file for juanji2.fig% FIG = JUANJI2 launch juanji2 GUI.% JUANJI2('callback_name', ...) invoke the named callback.% Last Modified by GUIDE v2.0 12-Dec-2003 09:22:05if nargin == 0 % LAUNCH GUI fig = openfig(mfilename,'reuse'); % Use system color scheme for figure: set(fig,'Color',get(0,'defaultUicontrolBackgroundColor')); % Generate a structure of handles to pass to callbacks, and store it. handles = guihandles(fig); guidata(fig, handles); if nargout > 0 varargout{1} = fig; endelseif ischar(varargin{1}) % INVOKE NAMED SUBFUNCTION OR CALLBACK try if (nargout) [varargout{1:nargout}] = feval(varargin{:}); % FEVAL switchyard else feval(varargin{:}); % FEVAL switchyard end catch disp(lasterr); endend%| ABOUT CALLBACKS:%| GUIDE automatically appends subfunction prototypes to this file, and %| sets objects' callback properties to call them through the FEVAL %| switchyard above. This comment describes that mechanism.%|%| Each callback subfunction declaration has the following form:%| <SUBFUNCTION_NAME>(H, EVENTDATA, HANDLES, VARARGIN)%|%| The subfunction name is composed using the object's Tag and the %| callback type separated by '_', e.g. 'slider2_Callback',%| 'figure1_CloseRequestFcn', 'axis1_ButtondownFcn'.%|%| H is the callback object's handle (obtained using GCBO).%|%| EVENTDATA is empty, but reserved for future use.%|%| HANDLES is a structure containing handles of components in GUI using%| tags as fieldnames, e.g. handles.figure1, handles.slider2. This%| structure is created at GUI startup using GUIHANDLES and stored in%| the figure's application data using GUIDATA. A copy of the structure%| is passed to each callback. You can store additional information in%| this structure at GUI startup, and you can change the structure%| during callbacks. Call guidata(h, handles) after changing your%| copy to replace the stored original so that subsequent callbacks see%| the updates. Type "help guihandles" and "help guidata" for more%| information.%|%| VARARGIN contains any extra arguments you have passed to the%| callback. Specify the extra arguments by editing the callback%| property in the inspector. By default, GUIDE sets the property to:%| <MFILENAME>('<SUBFUNCTION_NAME>', gcbo, [], guidata(gcbo))%| Add any extra arguments after the last argument, before the final%| closing parenthesis.% --------------------------------------------------------------------function varargout = pushbutton1_Callback(h, eventdata, handles, varargin)t=-6:5;x1=[1,1,1,1,0,0,1,1,1,1,0,0];l1=length(x1);x2=[0,1,2,1,0,0,0,1,2,1,0,0];l2=length(x2);lmax=max(l1,l2);dt=0.5; hf=fliplr(x2); y=zeros(1,3*lmax); axes(handles.axes4); hold off; for k=-6:6 p=[hf(end),hf(1:end-1)]; y1=x1.*p*dt; yk=sum(y1); y(k+lmax+1)=yk; axes(handles.axes1); t1=-0.2;t2=5.8; y=0:0.2:2; plot(t1,y,'r',t2,y,'r');hold on ylabel('x1'); stem(t,x1); axis([-6,6,0,2]); axes(handles.axes2); t3=-0.2;t4=5.8; y3=0:0.2:2; plot(t3,y3,'r',t4,y3,'r');hold on stem(t,p);axis([-6,6,0,2]);hold off ylabel('x2(m-k)'); axes(handles.axes3); t5=-0.2;t6=5.8; y4=0:0.2:2; plot(t5,y4,'r',t6,y4,'r');hold on stem(t,y1);axis([-6,6,0,2]);hold off ylabel('s=x1.*x2(m-k)'); axes(handles.axes4); t7=-0.2;t8=5.8; y6=0:0.2:5; plot(t7,y6,'r',t8,y6,'r');hold on ylabel('y(k)=sum(s)*dt'); stem(k,yk);axis([-6,6,0,5]);hold on drawnow; pause(1); hf = p; end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -