⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 yingshe.m

📁 这是matlab中的一些有用并且常见的原代码
💻 M
字号:
function varargout = yingshe(varargin)% YINGSHE Application M-file for yingshe.fig%    FIG = YINGSHE launch yingshe GUI.%    YINGSHE('callback_name', ...) invoke the named callback.% Last Modified by GUIDE v2.0 11-Dec-2003 16:43:34if 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.global  i;% --------------------------------------------------------------------function varargout = slider2_Callback(h, eventdata, handles, varargin)a=get(handles.slider3,'value');b=pi*get(handles.slider2,'value');t=0:0.01:2*pi;x=cos(t);y=sin(t);axes(handles.axes1);plot(x,y),axis('equal'),hold on;axis([-2, 2,-2, 2]); T=2; if (a==0)     r=1; else     r=exp(a*T);  end if(b==0)     angle=0; else     angle=b*T;end e=r*cos(angle); f=r*sin(angle); axes(handles.axes1); line([0,0],[-6,6]),line([-6,6],[0,0]) axis('equal'),hold onplot(e,f,'.','color','r');axis([-2,2,-2,2])axes(handles.axes6);line([0,0],[-6,6]),line([-6,6],[0,0]);axis('equal');hold on s=a+j*b; plot(a,b,'.','color','r'); axis([-6,6,-6,6]);i=3;save('i.txt', 'i', '-ascii');% --------------------------------------------------------------------function varargout = slider3_Callback(h, eventdata, handles, varargin)a=get(handles.slider3,'value');b=pi*get(handles.slider2,'value');%b为虚部,a为实部%以下是s平面和z平面的关系t=0:0.01:2*pi;x=cos(t);y=sin(t);axes(handles.axes1);line([0,0],[-6,6]),line([-6,6],[0,0]),hold onplot(x,y),axis('equal'),hold on;axis([-2, 2,-2, 2]); T=2; if (a==0)     r=1; else     r=exp(a*T);  end if(b==0)     angle=0; else     angle=b*T;end e=r*cos(angle); f=r*sin(angle);plot(e,f,'.','color','g');hold on;axes(handles.axes6);line([0,0],[-6,6]),line([-6,6],[0,0]);axis('equal'),hold on s=a+j*b; plot(a,b,'.','color','g'); axis([-6,6,-6,6]); i=1; save('i.txt', 'i', '-ascii');% --------------------------------------------------------------------function varargout = text1_ButtonDownFcn(h, eventdata, handles, varargin)% --------------------------------------------------------------------function varargout = axes1_CreateFcn(h, eventdata, handles, varargin)%z=r*exp(j*w);%plot(z);% --------------------------------------------------------------------function varargout = axes2_CreateFcn(h, eventdata, handles, varargin)% --------------------------------------------------------------------function varargout = slider4_Callback(h, eventdata, handles, varargin)T=2;r1=get(handles.slider4,'value');w=pi*get(handles.slider6,'value');t=0:0.01:2*pi;x=cos(t);y=sin(t);axes(handles.axes1);line([0,0],[-6,6]),line([-6,6],[0,0]);hold onplot(x,y),axis('equal'),hold on;axis([-2, 2,-2, 2]);e=r1*cos(w); f=r1*sin(w); plot(e,f,'.','color','b'); if (r1==1)     a1=0; elseif(r1==0)     a1=0; else     a1=logm(abs(r1))/T; end b1=w/T; axes(handles.axes6); line([0,0],[-6,6]),line([-6,6],[0,0]);axis('equal'),hold onaxis([-2,2,-2,2]) s=a1+j*b1; plot(a1,b1,'.','color','b');  axis([-6,6,-6,6])   i=0;save('i.txt', 'i', '-ascii'); %j = load('iiii.txt')% --------------------------------------------------------------------% --------------------------------------------------------------------function varargout = slider6_Callback(h, eventdata, handles, varargin)T=2;r1=get(handles.slider4,'value');w=pi*get(handles.slider6,'value');t=0:0.01:2*pi;x=cos(t);y=sin(t);axes(handles.axes1);plot(x,y),axis('equal'),hold on;line([0,0],[-6,6]),line([-6,6],[0,0]);hold onaxis([-2, 2,-2, 2]);e=r1*cos(w); f=r1*sin(w); plot(e,f,'.','color','k'); if (r1==1)     a1=0;     elseif(r1==0)     a1=0; else     a1=logm(abs(r1))/T; end b1=w/T; axes(handles.axes6); line([0,0],[-6,6]),line([-6,6],[0,0]);axis('equal'),hold onaxis([-2, 2,-2, 2]); s=a1+j*b1; plot(a1,b1,'.','color','k');axis([-6,6,-6,6]);i=2;save('i.txt', 'i', '-ascii');% --------------------------------------------------------------------%function varargout = slider9_Callback(h, eventdata, handles, varargin)% --------------------------------------------------------------------%function varargout = slider10_Callback(h, eventdata, handles, varargin)% --------------------------------------------------------------------function varargout = pushbutton1_Callback(h, eventdata, handles, varargin)axes(handles.axes1);cla  ;t=0:0.01:2*pi;x=cos(t);y=sin(t);plot(x,y),axis('equal'),hold on;line([0,0],[-6,6]),line([-6,6],[0,0]);hold onaxis([-2, 2,-2, 2]);axes(handles.axes6);cla ;line([0,0],[-6,6]),line([-6,6],[0,0]);axis('equal'),hold onaxis([-2, 2,-2, 2]);% --------------------------------------------------------------------function varargout = pushbutton2_Callback(h, eventdata, handles, varargin)% --------------------------------------------------------------------function varargout = pushbutton4_Callback(h, eventdata, handles, varargin)j = load('i.txt');if(j==0)T=2;r1=get(handles.slider4,'value');if (r1==1)     a1=0; elseif(r1==0)     a1=0; else     a1=logm(abs(r1))/T; endfor w=-pi:0.2:pi e=r1*cos(w); f=r1*sin(w); axes(handles.axes1) plot(e,f,'.','color','b'); b1=w/T; axes(handles.axes6);axis([-2, 2,-2, 2]); s=a1+j*b1; plot(a1,b1,'.','color','b');axis([-2,2,-2,2]);drawnow; pause(0.3);endendif (j==1)   a=get(handles.slider3,'value'); T=2; if (a==0)     r=1; else     r=exp(a*T);  end for b=-pi/T:0.2:pi/T if(b==0)     angle=0; else     angle=b*T;endaxes(handles.axes1); e=r*cos(angle); f=r*sin(angle);plot(e,f,'.','color','g');hold on;axes(handles.axes6); s=a+j*b; plot(a,b,'.','color','g'); axis([-2,2,-2,2]); drawnow; pause(0.3);endendif (j==2)    T=2;  w2=pi*get(handles.slider6,'value');  for r2=-1:0.15:1 e=r2*cos(w2); f=r2*sin(w2); axes(handles.axes1) plot(e,f,'.','color','k'); if (r2==1)     a2=0; elseif(r2==0)     a2=0; else     a2=logm(abs(r2))/T; end b2=w2/T; axes(handles.axes6); s=a2+j*b2; plot(a2,b2,'.','color','k');axis([-2,2,-2,2]); drawnow;pause(0.3);endendif(j==3)    T=2;b4=pi*get(handles.slider2,'value'); angle4=b4*T;for r4=-1:0.15:1 e4=r4*cos(angle4); f4=r4*sin(angle4); axes(handles.axes1);plot(e4,f4,'.','color','r');axis([-2,2,-2,2])if (r4==1)     a4=0;      elseif(r4==0)     a4=0; else     a4=logm(abs(r4))/T; endaxes(handles.axes6); s=a4+j*b4; plot(a4,b4,'.','color','r'); axis([-2,2,-2,2]);drawnow;pause(0.3);endend    

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -