📄 jfk1.m
字号:
function varargout = jfk1(varargin)
% JFK1 M-file for jfk1.fig
% JFK1, by itself, creates a new JFK1 or raises the existing
% singleton*.
%
% H = JFK1 returns the handle to a new JFK1 or the handle to
% the existing singleton*.
%
% JFK1('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in JFK1.M with the given input arguments.
%
% JFK1('Property','Value',...) creates a new JFK1 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before jfk1_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to jfk1_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 jfk1
% Last Modified by GUIDE v2.5 11-Jun-2005 11:23:19
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @jfk1_OpeningFcn, ...
'gui_OutputFcn', @jfk1_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 jfk1 is made visible.
function jfk1_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 jfk1 (see VARARGIN)
% Choose default command line output for jfk1
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes jfk1 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = jfk1_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;
% --- Executes during object creation, after setting all properties.function slider1_CreateFcn(hObject, eventdata, handles)% hObject handle to slider1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: slider controls usually have a light gray background, change% 'usewhitebg' to 0 to use default. See ISPC and COMPUTER.usewhitebg = 1;if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]);else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --- Executes on slider movement.function slider1_Callback(hObject, eventdata, handles)% hObject handle to slider1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'Value') returns position of slider% get(hObject,'Min') and get(hObject,'Max') to determine range of slider% --- Executes during object creation, after setting all properties.function slider2_CreateFcn(hObject, eventdata, handles)% hObject handle to slider2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: slider controls usually have a light gray background, change% 'usewhitebg' to 0 to use default. See ISPC and COMPUTER.usewhitebg = 1;if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]);else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --- Executes on slider movement.function slider2_Callback(hObject, eventdata, handles)% hObject handle to slider2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'Value') returns position of slider% get(hObject,'Min') and get(hObject,'Max') to determine range of slider% --- Executes during object creation, after setting all properties.function pop_CreateFcn(hObject, eventdata, handles)% hObject handle to pop (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: popupmenu controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --- Executes on selection change in pop.function pop_Callback(hObject, eventdata, handles)% hObject handle to pop (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: contents = get(hObject,'String') returns pop contents as cell array% contents{get(hObject,'Value')} returns selected item from pop% --- Executes on button press in push1.function push1_Callback(hObject, eventdata, handles)% hObject handle to push1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)
Ka=(get(handles.slider1,'Value')+eps);
Kb=(get(handles.slider2,'Value')+eps);
Ka1=Ka*pi;Kb1=Kb*pi;
set(handles.edit1,'string',num2str(Ka));
set(handles.edit2,'string',num2str(Kb));
T=0:0.1:2*pi;A=T;
n=get(handles.pop,'Value');
popstr={'spring','summer','autumn','winter','hot','cool','jet'};
[t,a]=meshgrid(T,A);
f=(1+cos(t+eps)).*sin(Ka1*sin(t+eps).*cos(a+eps)).*sin(Kb1*sin(t+eps).*sin(a+eps))./(Ka1.*sin(t+eps).*cos(a+eps).*Kb1.*sin(t+eps).*sin(a+eps));
[x,y,z]=sph2cart(t,a,f);
axes(handles.axes1);
surf(x,y,z);colormap(popstr{n});title('球坐标');
axes(handles.axes2);
surf(t,a,f);colormap(popstr{n});title('直角坐标') ;
% --- Executes on button press in push2.function push2_Callback(hObject, eventdata, handles)% hObject handle to push2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)close;% --- Executes during object creation, after setting all properties.function edit1_CreateFcn(hObject, eventdata, handles)% hObject handle to edit1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction edit1_Callback(hObject, eventdata, handles)% hObject handle to edit1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit1 as text% str2double(get(hObject,'String')) returns contents of edit1 as a double% --- Executes during object creation, after setting all properties.function edit2_CreateFcn(hObject, eventdata, handles)% hObject handle to edit2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction edit2_Callback(hObject, eventdata, handles)% hObject handle to edit2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit2 as text% str2double(get(hObject,'String')) returns contents of edit2 as a double% --- Executes on button press in pushbutton3.function pushbutton3_Callback(hObject, eventdata, handles)% hObject handle to pushbutton3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)Ka=(get(handles.slider1,'Value')+eps);
Kb=(get(handles.slider2,'Value')+eps);
Ka1=Ka*pi;Kb1=Kb*pi;
set(handles.edit1,'string',num2str(Ka));
set(handles.edit2,'string',num2str(Kb));
t=0:0.01:2*pi;
n=get(handles.pop,'Value');
f1=(1+cos(t)).*sin(Ka1*sin(t))./(Ka1*sin(t));
f2=(1+cos(t)).*sin(Kb1*sin(t))./(Kb1*sin(t));
axes(handles.axes1);
polar(t,f1);title('f({\theta},0)');
axes(handles.axes2);
polar(t,f2);title('f({\theta},{\pi}/2)');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -