📄 abcpp.m
字号:
function varargout = ABCpp(varargin)
% ______________________________________
%
% Chua's oscillator is described by a set of three
% ordinary differential equations called Chua's equations:
%
% dI3 R0 1
% --- = - -- I3 - - V2
% dt L L
%
% dV2 1 G
% --- = -- I3 - -- (V2 - V1)
% dt C2 C2
%
% dV1 G 1
% --- = -- (V2 - V1) - -- f(V1)
% dt C1 C1
%
% where
%
% f(V1) = Gb V1 + - (Ga - Gb)(|V1 + E| - |V1 - E|)
%
% A solution of these equations (I3,V2,V1)(t) starting from an
% initial state (I3,V2,V1)(0) is called a trajectory of Chua's
% oscillator.
%
% This function uses a RungeKutta integration method optimised for the chua circuit
%
% Reference:
% ABC - Adventures in Bifurication & Chaos ... Prof M.P Kennedy 1993
%
%
% James McEvoy, Tom Murray
%
% University e-mail: 99375940@student.ucc.ie
% Lifetime e-mail: sacevoy@eircom.net
% Homepage: http://www.sacevoy.com
%
% 2 Nov 2002
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @ABCpp_OpeningFcn, ...
'gui_OutputFcn', @ABCpp_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin & isstr(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 ABCpp is made visible.
function ABCpp_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 ABCpp (see VARARGIN)
% Choose default command line output for ABCpp
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes ABCpp wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = ABCpp_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 structure
varargout{1} = handles.output;
% --------------------------------------------------------------------function attractor_Callback(hObject, eventdata, handles)% hObject handle to attractor (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------function DR4_Callback(hObject, eventdata, handles)% hObject handle to DR4 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)
handles.TimeSeries = chua(-9.7136,4.75,-1.0837,33.932813,-.5,.0064,1,1,0.722549259662628,-4.87812995910645,-4.80317687988281,1500,.04);
handles.p = plot3(handles.TimeSeries(1,1),handles.TimeSeries(2,1),handles.TimeSeries(3,1),'o', ...
'EraseMode','none','MarkerSize',3);
handles.xmax = max(handles.TimeSeries(1,:));
handles.xmin = min(handles.TimeSeries(1,:));
handles.ymax = max(handles.TimeSeries(2,:));
handles.ymin = min(handles.TimeSeries(2,:));
handles.zmax = max(handles.TimeSeries(3,:));
handles.zmin = min(handles.TimeSeries(3,:));
axis([handles.xmin handles.xmax handles.ymin handles.ymax handles.zmin handles.zmax]);
view(90,90);grid on;
for i=1:1500
if rem(i,50) == 0
set(handles.p,'color',[rand rand rand])
end
set(handles.p,'XData',handles.TimeSeries(1,i+1),'YData',handles.TimeSeries(2,i+1),'ZData', handles.TimeSeries(3,i+1))
drawnow
i=i+1;
pause(.01)
end% --------------------------------------------------------------------function GC17_Callback(hObject, eventdata, handles)% hObject handle to GC17 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)
handles.TimeSeries2 = chua(-5,0,10,1,-1.14292,-0.7142,-2.43,1,-0.870016515254974,0.0848340690135956,0.897900283336639,1024,1);
handles.p = plot3(handles.TimeSeries2(1,1),handles.TimeSeries2(2,1),handles.TimeSeries2(3,1),'o', ...
'EraseMode','none','MarkerSize',3);
handles.xmax = max(handles.TimeSeries2(1,:));
handles.xmin = min(handles.TimeSeries2(1,:));
handles.ymax = max(handles.TimeSeries2(2,:));
handles.ymin = min(handles.TimeSeries2(2,:));
handles.zmax = max(handles.TimeSeries2(3,:));
handles.zmin = min(handles.TimeSeries2(3,:));
axis([handles.xmin handles.xmax handles.ymin handles.ymax handles.zmin handles.zmax]);
view(90,90);grid on;
for i=1:1024
if rem(i,50) == 0
set(handles.p,'color',[rand rand rand])
end
set(handles.p,'XData',handles.TimeSeries2(1,i+1),'YData',handles.TimeSeries2(2,i+1),'ZData', handles.TimeSeries2(3,i+1))
drawnow
i=i+1;
pause(.01)
end% --------------------------------------------------------------------function close_Callback(hObject, eventdata, handles)% hObject handle to close (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)delete(handles.figure1)% --------------------------------------------------------------------function DR2_Callback(hObject, eventdata, handles)% hObject handle to DR2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)
handles.TimeSeries2 = chua(-9.7136,4.7,-1.0837,33.932813,-.5,.0064,1,1,0.752286672592163,-3.93914341926575,-3.8665657043457,2500,.04);
handles.p = plot3(handles.TimeSeries2(1,1),handles.TimeSeries2(2,1),handles.TimeSeries2(3,1),'o', ...
'EraseMode','none','MarkerSize',3);
handles.xmax = max(handles.TimeSeries2(1,:));
handles.xmin = min(handles.TimeSeries2(1,:));
handles.ymax = max(handles.TimeSeries2(2,:));
handles.ymin = min(handles.TimeSeries2(2,:));
handles.zmax = max(handles.TimeSeries2(3,:));
handles.zmin = min(handles.TimeSeries2(3,:));
axis([handles.xmin handles.xmax handles.ymin handles.ymax handles.zmin handles.zmax]);
view(90,90);grid on;
for i=1:2500
if rem(i,50) == 0
set(handles.p,'color',[rand rand rand])
end
set(handles.p,'XData',handles.TimeSeries2(1,i+1),'YData',handles.TimeSeries2(2,i+1),'ZData', handles.TimeSeries2(3,i+1))
drawnow
i=i+1;
pause(.01)
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -