±±¾©Ê¯ÓÍ»¯¹¤Ñ§Ôº2026ÄêÑо¿ÉúÕÐÉú½ÓÊÕµ÷¼Á¹«¸æ
²é¿´: 2153  |  »Ø¸´: 13
µ±Ç°Ö»ÏÔʾÂú×ãÖ¸¶¨Ìõ¼þµÄ»ØÌû£¬µã»÷ÕâÀï²é¿´±¾»°ÌâµÄËùÓлØÌû

ÍûÔÂÈÎ

гæ (СÓÐÃûÆø)

[ÇóÖú] matlab guiÇóÖú ÒÑÓÐ2È˲ÎÓë

ÈçºÎ´´½¨Ò»¸ö°´Å¥µ÷ÓÃMÎļþ£¬²¢½«ÏÔʾÔÚÏÔʾÔÚÒ»¸öÎı¾¿òÖУ¬Èçͼµã»÷ÄǸöä¯ÀÀ°´Å¥Ëùʾ¡£Ð»Ð»´ó¼Ò

matlab guiÇóÖú
2YKN`C86P@ZR]7}V5BXS]WO.png


matlab guiÇóÖú-1
YAO(R~RDP([420[T0B8$0]A.png


matlab guiÇóÖú-2
]O[26OH(QL7YKRV[4K~R5%C.png
»Ø¸´´ËÂ¥

» ²ÂÄãϲ»¶

» ±¾Ö÷ÌâÏà¹Ø¼ÛÖµÌùÍÆ¼ö£¬¶ÔÄúͬÑùÓаïÖú:

ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

ÍûÔÂÈÎ

гæ (СÓÐÃûÆø)

ÒýÓûØÌû:
7Â¥: Originally posted by onelightwang at 2015-11-30 19:20:48
Ìù´úÂë

function varargout = DemoGUI(varargin)
% DEMOGUI M-file for DemoGUI.fig
%      DEMOGUI, by itself, creates a new DEMOGUI or raises the existing
%      singleton*.
%
%      H = DEMOGUI returns the handle to a new DEMOGUI or the handle to
%      the existing singleton*.
%
%      DEMOGUI('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in DEMOGUI.M with the given input arguments.
%
%      DEMOGUI('Property','Value',...) creates a new DEMOGUI or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before DemoGUI_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to DemoGUI_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 DemoGUI

% Last Modified by GUIDE v2.5 16-Apr-2005 18:42:13

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @DemoGUI_OpeningFcn, ...
                   'gui_OutputFcn',  @DemoGUI_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 DemoGUI is made visible.
function DemoGUI_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 DemoGUI (see VARARGIN)

% Choose default command line output for DemoGUI
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes DemoGUI wait for user response (see UIRESUME)
% uiwait(handles.DemoFig);

% ÈÕÆÚʱ¼äÏÔʾ
set(handles.timestr,'string',datestr(now,0));
htimer = timer('StartDelay',1,'TimerFcn',...
    'htimestr=findall(0,''tag'',''timestr'');set(htimestr,''string'',datestr(now,0));',...
    'Period',1,'ExecutionMode','fixedSpacing','tag','showtime');
start(htimer);

set(hObject,'doublebuffer','on');



% --- Outputs from this function are returned to the command line.
function varargout = DemoGUI_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 on button press in ExitBtn.
function ExitBtn_Callback(hObject, eventdata, handles)
% hObject    handle to ExitBtn (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

selection = questdlg(['Í˳ö ' get(handles.DemoFig,'Name') '?'],...
                     ['Í˳ö ' get(handles.DemoFig,'Name') '...'],...
                     'ÊÇ','·ñ','ÊÇ');
if strcmp(selection,'·ñ')
    return;
end
htimer = timerfind('tag','showtime');
stop(htimer);
delete(htimer);
delete(handles.DemoFig);

% --- Executes on button press in HelpBtn.
function HelpBtn_Callback(hObject, eventdata, handles)
% hObject    handle to HelpBtn (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% str={'¶Ô²»Æð£¬Ä¿Ç°ÉÐδÍê³É˵Ã÷Îļþ';' ´òË㾡¿ìÍêÉÆÕû¸öϵͳ¹¦Äܼ°ÆäʹÓÃ˵Ã÷'};
% msgbox(str,'ʹÓðïÖú','help','non-modal');
!CNCHelp.CHM


% ¾«²å²¹°´Å¥»Øµ÷º¯Êý
% --- Executes on button press in JinBtn.
function JinBtn_Callback(hObject, eventdata, handles)
% hObject    handle to JinBtn (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% »ñÈ¡ÉèÖõIJÎÊýÖµ
theta0 = get(handles.startRad,'UserData'); % ÍâÂÖÀªÆðʼµã¼«½Ç
thetat = get(handles.endRad,'UserData'); % ÍâÂÖÀªÖÐÖ¹µã¼«½Ç
interpTime = get(handles.interpT,'UserData'); % ²å²¹ÖÜÆÚ ms
mihuaNum = get(handles.miHuaNum,'UserData'); % ÃÜ»¯µãÊý
jinjiV = get(handles.jinjiV,'UserData'); % ½ø¸øËÙ¶È mm/min
jinjiV = jinjiV/60; % ½ø¸øËÙ¶Èmm/sec
clrjinline = get(handles.clrJin,'BackgroundColor'); % ¾«²åÖµµãÏßÑÕÉ«
% »ñÈ¡ÍâÂÖÀªº¯ÊýÃû
filename = get(handles.SelectFcnBtn,'UserData');
if isempty(filename)
    msgbox('ûÓÐѡȡÂÖÀªº¯Êý£¡','²Ù×÷´íÎó');
    return;
end
[pathstr,fcnname] = fileparts(filename); %»ñµÃÎļþÃûÓë·¾¶Ãû
% ÅжÏÊÇ˳Բ»¹ÊÇÄæÔ²²å²¹,ʵÏÖ²»¹Ü˳Բ»¹ÊÇÄæÔ²¶¼¿ÉÓ㨲»¹ýÖ»²âÊÔÁË˳Բ£­£­ÄæÊ±Õë²å²¹£©
if theta0>thetat    % ÄæÔ²
    flag = -1;
else           % ˳Բ
    flag = 1;
end
set(gcf,'doublebuffer','on');
axis(handles.axes2); % ÉèÖÃaxes2Ϊµ±Ç°×ø±êÖá
hjinline = line('color',clrjinline,'marker','.','markersize',4,...
                     'visible','off', 'tag','jinline'); % ´´½¨´Ö²åÖµÏß¶ÔÏó  
culinedata = getappdata(handles.CuBtn,'culinedata');  % »ñÈ¡´Ö²å²¹ÏßÊý¾Ý
cutheta = culinedata(:,1);  % ¼«½Ç
curho = culinedata(:,2); % ¼«¾¶
numCu = length(culinedata); % ´Ö²å²¹µãÊý
theta = [];
r = [];
set(hjinline,'visible','on');
outflag = 0;
% hbar = waitbar(0,'Please wait...','name','¾«²å²¹½øÐÐÖÐ');
for k = 1:numCu-1 % ¶Ôÿ¶Î´Ö²å²¹Çé¿ö
    tmptheta = cutheta(k); % theta0
    rr0 = curho(k); % rho0
    theta = [theta tmptheta];
    r = [r rr0];
    [xd,yd] = pol2cart(theta,r); % ¼«×ø±ê±ä³ÉÆ½ÃæÖ±½Ç×ø±ê
    set(hjinline,'xdata',xd,'ydata',yd);
    for n = 2:mihuaNum % ¼ÆËãÿ¶Î´Ö²å²¹ÖÐÃÜ»¯µã×ø±ê
        drda = drdtheta(fcnname,tmptheta); % ¼ÆËã¸ÃµãµÄÊýֵ΢·Ö
        deletatheta = interpTime/1000*jinjiV/(drda^2+rr0^2)^(0.5); % ¼ÆËãdeltatheta
        tmptheta = flag*deletatheta+tmptheta; % µü´úÇóÈ¡ÏÂÒ»¸ö¼«½Ç
        if flag*tmptheta>flag*cutheta(end) % ¶ÔÓÚ×îºóÒ»¶ÎµÄÌØÊâ´¦Àí,ÒòΪ×îºóÒ»¶Î¿ÉÄܱÈÒÔǰµÄ¶Ì
            tmptheta = cutheta(end); % ÊDz»Äܹ»²åÈënum¸öÃÜ»¯µãµÄ
            outflag = 1;
        end
        rr0 = feval(fcnname,tmptheta);
        theta = [theta tmptheta];
        r = [r rr0];
        [xd,yd] = pol2cart(theta,r);
        set(hjinline,'xdata',xd,'ydata',yd);
        if outflag==1
            break;  % ×îºóÒ»¶ÎÌØÊâ´¦ÀíÊ±Ìø³öÑ­»·
        end
    end
%     waitbar(k/(numCu-1),hbar);
end
% close(hbar);
theta = [theta cutheta(end)];
r = [r curho(end)];
jinlinedata = [theta( r(];
setappdata(hObject,'jinlinedata',jinlinedata); % ±£´æ¾«²å²¹ÏßÊý¾Ýµ½¾ä±úÖÐ
set(handles.chkJin,'enable','on'); % ʹµÃÏÔʾÒþ²ØÏ߸´Ñ¡¿ò¿ÉÓÃ
chkLegend_Callback(handles.chkLegend,[], handles);



% ´Ö²å²¹°´Å¥»Øµ÷º¯Êý
% --- Executes on button press in CuBtn.
function CuBtn_Callback(hObject, eventdata, handles)
% hObject    handle to CuBtn (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% »ñÈ¡ÉèÖõIJÎÊýÖµ
theta0 = get(handles.startRad,'UserData'); % ÍâÂÖÀªÆðʼµã¼«½Ç
thetat = get(handles.endRad,'UserData'); % ÍâÂÖÀªÖÐÖ¹µã¼«½Ç
interpTime = get(handles.interpT,'UserData'); % ²å²¹ÖÜÆÚ ms
jinjiV = get(handles.jinjiV,'UserData'); % ½ø¸øËÙ¶È mm/min
jinjiV = jinjiV/60; % ½ø¸øËÙ¶Èmm/sec
clrlunline = get(handles.clrLun,'BackgroundColor'); % ÂÖÀªÏßÑÕÉ«
clrculine = get(handles.clrCu,'BackgroundColor'); % ´Ö²åÖµµãÏßÑÕÉ«

% »ñÈ¡ÍâÂÖÀªº¯ÊýÃû
filename = get(handles.SelectFcnBtn,'UserData');
if isempty(filename)
    msgbox('ûÓÐѡȡÂÖÀªº¯Êý£¡','²Ù×÷´íÎó');
    return;
end
[pathstr,fcnname] = fileparts(filename);
addpath(pathstr,'-begin');  % ½«ÍâÂÖÀªº¯ÊýËùÔÚ·¾¶¼ÓÈëmatlab·¾¶ÖÐ

set(handles.chklun,'enable','on'); % ʹ¸´Ñ¡¿ò¿ÉÓÃ
set(handles.chkLegend,'enable','on'); % ʹ¸´Ñ¡¿ò¿ÉÓÃ
set(handles.chkCu,'enable','on'); % ʹ¸´Ñ¡¿ò¿ÉÓÃ

% »æÖÆÍâÂÖÀªÏß
theta = linspace(theta0,thetat,1000);
r = feval(fcnname,theta); % ¼ÆËãÍâÂÖÀª
if length(r)~=length(theta)  % ͨ³£ÊÇÓÉÓÚÍâÂÖÀªº¯Êý²»¶ÔÔì³É
    msgbox('ÍâÂÖÀªº¯Êý´íÎó','³ö´íÁË...');
    return;
end
axis(handles.axes2);
hlunline = polar(theta,r);
set(hlunline,'color',clrlunline,'tag','lunline'); % ÉèÖÃtagÒÔºóºÃÓÃ
lundata = [theta( r(];
setappdata(hObject,'lundata',lundata); % ±£´æÂÖÀªÏßÊý¾Ýµ½¾ä±úÖÐ
hold on;
hculine = line('color',clrculine,'marker','.','markersize',10,...
                       'tag','culine'); % ´Ö²åÖµÏß¶ÔÏó  'erasemode','xor',
hold off;                 
theta = [];
r = [];
% ÅжÏÊÇ˳Բ»¹ÊÇÄæÔ²²å²¹,ʵÏÖ²»¹Ü˳Բ»¹ÊÇÄæÔ²¶¼¿ÉÓ㨲»¹ýÖ»²âÊÔÁË˳Բ£­£­ÄæÊ±Õë²å²¹£©
if theta0>thetat    % ÄæÔ²
    flag = -1;
else           % ˳Բ
    flag = 1;
end
tmptheta = theta0;
while flag*tmptheta<flag*thetat  % ÖÕÖ¹Åжϣ¬¿¼ÂÇÁË˳ԲÓëÄæÔ²
    rr0 = feval(fcnname,tmptheta); % ¼ÆËãÍâÂÖÀª¸Ã¼«½Ç³öµÄ¼«¾¶
    theta = [theta tmptheta];
    r = [r rr0];
    [xd,yd] = pol2cart(theta,r); % ת»»ÎªÖ±½Ç×ø±êϵÊýÖµ
    set(hculine,'xdata',xd,'ydata',yd); % ¸üвåÖµµã
    drda = drdtheta(fcnname,tmptheta); % ¼ÆËã¸Ã¼«½Ç´¦Êýֵ΢·Ö
    deletatheta = interpTime/1000*jinjiV/(drda^2+rr0^2)^(0.5);
    tmptheta = flag*deletatheta+tmptheta; % µü´úÇóÈ¡ÏÂÒ»¸öµã¼«½Ç
end
rr0 = feval(fcnname,thetat); % ÖÕµã¼ÓÈë
theta = [theta thetat];
r = [r rr0];
culinedata = [theta( r(];
setappdata(hObject,'culinedata',culinedata); % ±£´æ´Ö²å²¹ÏßÊý¾Ýµ½¾ä±úÖÐ

set(handles.ExportDataBtn,'enable','on');
set(handles.JinBtn,'enable','on');
chkLegend_Callback(handles.chkLegend,[], handles); % µ÷ÓÃͼÀý¸´Ñ¡¿òµÄ»Øµôº¯Êý

% --- Executes during object creation, after setting all properties.
function FcnName_CreateFcn(hObject, eventdata, handles)
% hObject    handle to FcnName (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'));
end




% --- Executes on button press in SelectFcnBtn.
function SelectFcnBtn_Callback(hObject, eventdata, handles)
% hObject    handle to SelectFcnBtn (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

[filename, pathname] = uigetfile('*.m', 'ѡȡÍâÂÖÀªÏßMÎļþ');
if filename~=0
    set(handles.FcnName,'string',filename);
    set(hObject,'UserData',[pathname filename]);
    set(handles.JinBtn,'enable','off');
    set(handles.ExportDataBtn,'enable','off');
    set(handles.chklun,'enable','off');
    set(handles.chkCu,'enable','off');
    set(handles.chkJin,'enable','off');
    set(handles.chkLegend,'value',0,'enable','off');
    axis(handles.axes2);
    cla
    chkLegend_Callback(handles.chkLegend,[], handles); % ¸üÐÂͼÁÐ
else
    set(handles.FcnName,'string','ÉÐδѡȡ');
end


% --- Executes on button press in ExportDataBtn.
function ExportDataBtn_Callback(hObject, eventdata, handles)
% hObject    handle to ExportDataBtn (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% str={'¶Ô²»Æð£¬Ä¿Ç°ÉÐδÍê³É˵Ã÷Îļþ';' ´òË㾡¿ìÍêÉÆÕû¸öϵͳ¹¦Äܼ°ÆäʹÓÃ˵Ã÷'};
% msgbox(str,'ʹÓðïÖú','help','non-modal');

type = get(handles.dataType,'UserData'); % »ñÈ¡ÉèÖõĵ¼³öÊý¾Ý¸ñʽ 1-mat,2-txt,3-dat

% % »ñÈ¡¸÷ÖÖͼÏߵľä±ú
% hjinline = findobj(0,'tag','jinline');
% hculine = findobj(0,'tag','culine');
% hlunline = findobj(0,'tag','lunline');
% ±£´æÊ±
% % handles.CuBtn
% setappdata(hObject,'culinedata',culinedata); % ±£´æ´Ö²å²¹ÏßÊý¾Ýµ½¾ä±úÖÐ
% setappdata(hObject,'lundata',lundata); % ±£´æÂÖÀªÏßÊý¾Ýµ½¾ä±úÖÐ
% % handles.JinBtn
% setappdata(hObject,'jinlinedata',jinlinedata); % ±£´æ¾«²å²¹ÏßÊý¾Ýµ½¾ä±úÖÐ
lundata = getappdata(handles.CuBtn,'lundata');
culinedata = getappdata(handles.CuBtn,'culinedata');
jinlinedata = getappdata(handles.JinBtn,'jinlinedata');

switch type
    case 1,
        [filename, pathname] = uiputfile('*.mat', '±£´æ²å²¹½á¹û');
        if filename==0 % È¡Ïû
            return;
        end
        save([pathname filename],'lundata','culinedata','jinlinedata');
    case 2,
        [filename, pathname] = uiputfile('*.txt', '±£´æ²å²¹½á¹û');
        if filename==0
            return;
        end
        [pathstr,filename]=fileparts(filename);
        fid = fopen([pathname filename,'.txt'],'w');
        fprintf(fid,'\n£¥=================%s=================\r\n',datestr(now,0));
        fprintf(fid,'£¥Ô­Ê¼ÍâÂÖÀªÏßÊý¾Ý\r\n');
        fprintf(fid,'£¥ ¼«½Ç     \t   ¼«¾¶\r\n');
        fprintf(fid,'%8.6f  \t  %8.6f\r\n',lundata');
        fprintf(fid,'£¥´Ö²å²¹µãÊý¾Ý\r\n');
        fprintf(fid,'£¥ ¼«½Ç     \t   ¼«¾¶\r\n');
        fprintf(fid,'%8.6f  \t  %8.6f\r\n',culinedata');
        fprintf(fid,'£¥¾«²å²¹µãÊý¾Ý\r\n');
        fprintf(fid,'£¥ ¼«½Ç     \t   ¼«¾¶\r\n');
        fprintf(fid,'%8.6f  \t  %8.6f\r\n',jinlinedata');
        fclose(fid);   
    case 3,
        [filename, pathname] = uiputfile('*.dat', '±£´æ²å²¹½á¹û');
        if filename==0
            return;
        end
        [pathstr,filename]=fileparts(filename);
        save([pathname filename,'.dat'],'lundata','culinedata','jinlinedata','-ascii','-double');
    otherwise,
        msgbox('ÕÕµÀÀíÊDz»»á³öÏÖµÄ~');
end






% --- Executes on button press in ResetBtn.
function ResetBtn_Callback(hObject, eventdata, handles)
% hObject    handle to ResetBtn (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% ÉèÖø÷ÖÖ²ÎÊýΪĬÈÏÖµ
set(handles.startRad,'string','0','UserData',0);
set(handles.endRad,'string','2*pi','UserData',2*pi);
set(handles.miHuaNum,'string','4','UserData',4);
set(handles.interpT,'string','8','UserData',8);
set(handles.jinjiV,'string','4000','UserData',4000);
set(handles.clrLun,'BackgroundColor',[0 0 0]);
set(handles.clrCu,'BackgroundColor',[0 0 1]);
set(handles.clrJin,'BackgroundColor',[1 1 0.5]);
set(handles.dataType,'value',1,'UserData',1);
set(handles.chkLegend,'value',0,'UserData',0);


% --- Executes during object creation, after setting all properties.
function startRad_CreateFcn(hObject, eventdata, handles)
% hObject    handle to startRad (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'));
end



function startRad_Callback(hObject, eventdata, handles)
% hObject    handle to startRad (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 startRad as text
%        str2double(get(hObject,'String')) returns contents of startRad as a double

str = get(hObject,'string');
data = str2num(str);
if isempty(data)  % ÊäÈë²ÎÊýÓÐЧÐÔ¼ì²â
    errordlg('ÊäÈë±ØÐëΪÊýÖµ£¡','²ÎÊý´íÎó');
    set(hObject,'BackgroundColor','r');
else
    set(hObject,'BackgroundColor','w');
    set(hObject,'UserData',data);
end


% --- Executes during object creation, after setting all properties.
function endRad_CreateFcn(hObject, eventdata, handles)
% hObject    handle to endRad (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'));
end



function endRad_Callback(hObject, eventdata, handles)
% hObject    handle to endRad (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 endRad as text
%        str2double(get(hObject,'String')) returns contents of endRad as a double

str = get(hObject,'string');
data = str2num(str);
if isempty(data) % ÊäÈë²ÎÊýÓÐЧÐÔ¼ì²â
    errordlg('ÊäÈë±ØÐëΪÊýÖµ£¡','²ÎÊý´íÎó');
    set(hObject,'BackgroundColor','r');
else
    set(hObject,'BackgroundColor','w');
    set(hObject,'UserData',data);
end



% --- Executes during object creation, after setting all properties.
function miHuaNum_CreateFcn(hObject, eventdata, handles)
% hObject    handle to miHuaNum (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'));
end



function miHuaNum_Callback(hObject, eventdata, handles)
% hObject    handle to miHuaNum (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 miHuaNum as text
%        str2double(get(hObject,'String')) returns contents of miHuaNum as a double

str = get(hObject,'string');
data = str2num(str);
if isempty(data) % ÊäÈë²ÎÊýÓÐЧÐÔ¼ì²â
    errordlg('ÊäÈë±ØÐëΪÊýÖµ£¡','²ÎÊý´íÎó');
    set(hObject,'BackgroundColor','r');
else
    set(hObject,'BackgroundColor','w');
    set(hObject,'UserData',data);
end



% --- Executes during object creation, after setting all properties.
function interpT_CreateFcn(hObject, eventdata, handles)
% hObject    handle to interpT (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'));
end



function interpT_Callback(hObject, eventdata, handles)
% hObject    handle to interpT (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 interpT as text
%        str2double(get(hObject,'String')) returns contents of interpT as a double

str = get(hObject,'string');
data = str2num(str);
if isempty(data) % ÊäÈë²ÎÊýÓÐЧÐÔ¼ì²â
    errordlg('ÊäÈë±ØÐëΪÊýÖµ£¡','²ÎÊý´íÎó');
    set(hObject,'BackgroundColor','r');
else
    set(hObject,'BackgroundColor','w');
    set(hObject,'UserData',data);
end



% --- Executes during object creation, after setting all properties.
function jinjiV_CreateFcn(hObject, eventdata, handles)
% hObject    handle to jinjiV (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'));
end



function jinjiV_Callback(hObject, eventdata, handles)
% hObject    handle to jinjiV (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 jinjiV as text
%        str2double(get(hObject,'String')) returns contents of jinjiV as a double

str = get(hObject,'string');
data = str2num(str);
if isempty(data) % ÊäÈë²ÎÊýÓÐЧÐÔ¼ì²â
    errordlg('ÊäÈë±ØÐëΪÊýÖµ£¡','²ÎÊý´íÎó');
    set(hObject,'BackgroundColor','r');
else
    set(hObject,'BackgroundColor','w');
    set(hObject,'UserData',data);
end


% --- Executes during object creation, after setting all properties.
function dataType_CreateFcn(hObject, eventdata, handles)
% hObject    handle to dataType (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 dataType.
function dataType_Callback(hObject, eventdata, handles)
% hObject    handle to dataType (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 dataType contents as cell array
%        contents{get(hObject,'Value')} returns selected item from dataType

% 1 - mat; 2 - txt ; 3 - dat
datatype = get(hObject,'Value');
set(hObject,'UserData',datatype);


% --- If Enable == 'on', executes on mouse press in 5 pixel border.
% --- Otherwise, executes on mouse press in 5 pixel border or over clrLun.
function clrLun_ButtonDownFcn(hObject, eventdata, handles)
% hObject    handle to clrLun (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% ÑÕÉ«ÉèÖô¦Àí
color = uisetcolor;
if length(color)~=1 % Èç¹ûѡȡÁËÑÕÉ«
    set(hObject,'BackgroundColor',color);
    hlunline = findobj(0,'tag','lunline');
    if ~isempty(hlunline) % Èç¹ûÒÑ»æÖÆÍ¼Ïߣ¬Ôò°´ÕÕÉèÖõÄÑÕÉ«¸üÐÂͼÏß
        set(hlunline,'color',color);
    end
end

% --- If Enable == 'on', executes on mouse press in 5 pixel border.
% --- Otherwise, executes on mouse press in 5 pixel border or over clrJin.
function clrJin_ButtonDownFcn(hObject, eventdata, handles)
% hObject    handle to clrJin (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

color = uisetcolor;
if length(color)~=1
    set(hObject,'BackgroundColor',color);
    hjinline = findobj(0,'tag','jinline');
    if ~isempty(hjinline) % Èç¹ûÒÑ»æÖÆÍ¼Ïߣ¬Ôò°´ÕÕÉèÖõÄÑÕÉ«¸üÐÂͼÏß
        set(hjinline,'color',color);
    end
end


% --- If Enable == 'on', executes on mouse press in 5 pixel border.
% --- Otherwise, executes on mouse press in 5 pixel border or over clrCu.
function clrCu_ButtonDownFcn(hObject, eventdata, handles)
% hObject    handle to clrCu (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

color = uisetcolor;
if length(color)~=1
    set(hObject,'BackgroundColor',color);
    hculine = findobj(0,'tag','culine');
    if ~isempty(hculine) % Èç¹ûÒÑ»æÖÆÍ¼Ïߣ¬Ôò°´ÕÕÉèÖõÄÑÕÉ«¸üÐÂͼÏß
        set(hculine,'color',color);
    end
end


% --- Executes on button press in chklun.
function chklun_Callback(hObject, eventdata, handles)
% hObject    handle to chklun (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of chklun

% ͼÏßµÄÏÔʾÒþ²Ø¸´Ñ¡¿ò
val = get(hObject,'Value');
hlunline = findobj(0,'tag','lunline');
if ~isempty(hlunline) % Èç¹ûÒѾ­»æÖÆÍ¼Ïß
    if val==1 % Èç¹ûÊÇÑ¡Öи´Ñ¡¿ò
        set(hlunline,'visible','on'); % ÏÔʾ
    else
        set(hlunline,'visible','off');
    end
    chkLegend_Callback(handles.chkLegend,[], handles); % ¸üÐÂͼÁÐ
end


% --- Executes on button press in chkCu.
function chkCu_Callback(hObject, eventdata, handles)
% hObject    handle to chkCu (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of chkCu

val = get(hObject,'Value');
hculine = findobj(0,'tag','culine');
if ~isempty(hculine)
    if val==1
        set(hculine,'visible','on');
    else
        set(hculine,'visible','off');
    end
    chkLegend_Callback(handles.chkLegend,[], handles)
end

% --- Executes on button press in chkJin.
function chkJin_Callback(hObject, eventdata, handles)
% hObject    handle to chkJin (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of chkJin

val = get(hObject,'Value');
hjinline = findobj(0,'tag','jinline');
if ~isempty(hjinline)
    if val==1
        set(hjinline,'visible','on');
    else
        set(hjinline,'visible','off');
    end
    chkLegend_Callback(handles.chkLegend,[], handles)
end

% --- Executes on button press in chkLegend.
function chkLegend_Callback(hObject, eventdata, handles)
% hObject    handle to chkLegend (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of chkLegend

% ͼÀý¸´Ñ¡¿òµÄ´¦Àí
val = get(hObject,'Value');

if val ==1 % Èç¹ûÑ¡Öи´Ñ¡¿ò
    hjinline = findobj(0,'tag','jinline');
    hculine = findobj(0,'tag','culine');
    hlunline = findobj(0,'tag','lunline');
   
    % ²âÊÔÊÇ·ñÒѾ­»æÖÆÇúÏß ²¢ÇÒÇúÏßÊÇ·ñ¿É¼û
    jflag = ~isempty(hjinline) & (get(handles.chkJin,'value'));
    cflag = ~isempty(hculine) & (get(handles.chkCu,'value'));
    lflag = ~isempty(hlunline) & (get(handles.chklun,'value'));
    warning off MATLABeprecatedLogicalAPI % ¹Ø±Õ¾¯¸æÐÅÏ¢£¬ÒòΪlflagµÈÊÇlogical£¬ÓÃnum2strÓо¯¸æ
    strflag = [num2str(lflag) num2str(cflag) num2str(jflag)];
   
    switch strflag
        case '111', % È«²¿
            legend([hlunline hculine hjinline],'ÍâÂÖÀªÏß','´Ö²å²¹µã','¾«²å²¹µã',2); % »æÖÆÍ¼Àý
        case '110' % ²»ÏÔʾ¾«²å²¹
            legend([hlunline hculine],'ÍâÂÖÀªÏß','´Ö²å²¹µã',2)
        case '101', % ²»ÏÔʾ´Ö²å²¹
            legend([hlunline hjinline],'ÍâÂÖÀªÏß','¾«²å²¹µã',2)
        case '011', % ²»ÏÔʾÂÖÀªÏß
            legend([hculine hjinline],'´Ö²å²¹µã','¾«²å²¹µã',2)
        case '100',
            legend(hlunline,'ÍâÂÖÀªÏß',2)
        case '001',
            legend(hjinline,'¾«²å²¹µã',2)
        case '010',
            legend(hculine,'´Ö²å²¹µã',2)  
        otherwise
            legend off % ͼÀý²»ÏÔʾ
    end
   
else
    legend off; % ͼÀý²»ÏÔʾ
end







% ²ÉÓõȽھàÎåµãÇóµ¼¹«Ê½µÄÖе㹫ʽÇóÊýֵ΢·Ö
% ÕâÀï´æÔÚÒ»¸öÎÊÌâÊÇ£¬Êýֵ΢·ÖµÄʱºò£¬hµ½µ×ÈçºÎѡȡ£¿
% ×Ô¶¯Ñ¡È¡µÄËã·¨ÊÇÔõôÑùµÄ£¿Èç¹ûÒª×Ô¶¯Ñ¡È¡£¬ËÙ¶ÈÈçºÎ£¿
function dr = drdtheta( fcnname,theta0)
%
h = 0.001;
theta_2 = theta0 - 2*h;
theta_1 = theta0 - h;
theta1 = theta0 + h;
theta2 = theta0 + 2*h;
theta = [theta_2 theta_1 theta1 theta2];
r = feval(fcnname,theta);
dr = 1/(12*h)*(r(1) - 8*r(2) + 8*r(3) - r(4));
8Â¥2015-11-30 19:42:54
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû
²é¿´È«²¿ 14 ¸ö»Ø´ð

achilFes1990

ľ³æ (ÖøÃûдÊÖ)

¡¾´ð°¸¡¿Ó¦Öú»ØÌû

¸Ðл²ÎÓ룬ӦÖúÖ¸Êý +1
ÏȰ´ÕÕ°ïÖúÎĵµ»òÕß°¸Àý×öÒ»Á½¸öÀý×Ó°É£¬ÕâÖÖ°´Å¥µ÷ÓÃcallbackº¯ÊýµÄÀý×Ó£¬´ó²¿·Ö²Î¿¼ÊéÀïÃæ¶¼ÓУ¬ÄãÕÕ×Å×ö¾ÍÐÐÁË

[ ·¢×ÔÊÖ»ú°æ http://muchong.com/3g ]
ɨһɨ¹Ø×¢ÎÒµÄ΢ÐŹ«Öںţ¬¹²Í¬Ñ§Ï°´¬²°CFD
2Â¥2015-11-29 14:24:46
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

ÍûÔÂÈÎ

гæ (СÓÐÃûÆø)

ÒýÓûØÌû:
2Â¥: Originally posted by achilFes1990 at 2015-11-29 14:24:46
ÏȰ´ÕÕ°ïÖúÎĵµ»òÕß°¸Àý×öÒ»Á½¸öÀý×Ó°É£¬ÕâÖÖ°´Å¥µ÷ÓÃcallbackº¯ÊýµÄÀý×Ó£¬´ó²¿·Ö²Î¿¼ÊéÀïÃæ¶¼ÓУ¬ÄãÕÕ×Å×ö¾ÍÐÐÁË

Õâ¸ö¾ÍÊDZðÈË×öµÄÀý×Ó£¬ÎÒÊÔ×ÅËûµÄ·½·¨×öû×ö³öÀ´£¬ÏëÎÊÎÊ´ó¼ÒÔõô×öµÄ
3Â¥2015-11-29 14:26:28
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

onelightwang

½ð³æ (СÓÐÃûÆø)

¡¾´ð°¸¡¿Ó¦Öú»ØÌû

¸Ðл²ÎÓ룬ӦÖúÖ¸Êý +1
ÒýÓûØÌû:
3Â¥: Originally posted by ÍûÔÂÈÎ at 2015-11-29 14:26:28
Õâ¸ö¾ÍÊDZðÈË×öµÄÀý×Ó£¬ÎÒÊÔ×ÅËûµÄ·½·¨×öû×ö³öÀ´£¬ÏëÎÊÎÊ´ó¼ÒÔõô×öµÄ...

Èç¹ûÊÇÔËÐбðÈ˵ÄÀý×Ó£¬Â¥Ö÷ÐèҪעÒâÁ½¸öµØ·½£º
1.º¯ÊýÖÐÎļþµÄ·¾¶ÊÇ·ñÕýÈ·¡£
2.º¯ÊýËùÔÚ·¾¶ÊÇ·ñÌí¼Óµ½matlabµÄ·¾¶ÖС£
4Â¥2015-11-29 16:14:41
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû
×î¾ßÈËÆøÈÈÌûÍÆ¼ö [²é¿´È«²¿] ×÷Õß »Ø/¿´ ×îºó·¢±í
[¿¼ÑÐ] Ò»Ö¾Ô¸±±¾©Àí¹¤´óѧ±¾¿Æ211²ÄÁϹ¤³Ì294Çóµ÷¼Á +7 mikasaµÄΧ½í 2026-03-28 7/350 2026-03-29 10:21 by ms629
[¿¼ÑÐ] ÊýÒ»Ó¢Ò»271ר˶£¨085401£©Çóµ÷¼Á£¬¿É¿ç +7 ǰÐбØÓйâ 2026-03-28 8/400 2026-03-28 23:22 by Сľ³ætim
[¿¼ÑÐ] 22408 359·Öµ÷¼Á +4 Qshers 2026-03-27 5/250 2026-03-28 21:26 by zhq0425
[¿¼ÑÐ] ÉúÎïѧѧ˶£¬Ò»Ö¾Ô¸ºþÄÏ´óѧ£¬³õÊԳɼ¨338 +6 YYYYYNNNNN 2026-03-26 7/350 2026-03-28 20:52 by ÌÆãå¶ù
[¿¼ÑÐ] 394Çóµ÷¼Á +3 ºÃʶàÄ¥¾²ºò¼ÑÒ 2026-03-26 5/250 2026-03-28 14:24 by ÌÆãå¶ù
[¿¼ÑÐ] 070300Çóµ÷¼Á306·Ö +4 26ÒªÉϰ¶ 2026-03-27 4/200 2026-03-28 13:06 by ÌÆãå¶ù
[¿¼ÑÐ] ¡¾Çóµ÷¼Á¡¿085601²ÄÁϹ¤³Ìר˶ | ×Ü·Ö272 | +6 ½Å»¬µÄÊØ·¨¹«Ãñ 2026-03-27 6/300 2026-03-28 11:02 by gjlllb
[¿¼ÑÐ] 085404Çóµ÷¼Á£¬×Ü·Ö309£¬±¾¿Æ¾­Àú½ÏΪ·á¸» +4 À´²Æaa 2026-03-25 4/200 2026-03-28 07:41 by °ô°ôÇòÊÖ
[¿¼ÑÐ] 086000µ÷¼Á +3 7901117076 2026-03-26 3/150 2026-03-27 21:34 by Jianing_Mi
[¿¼ÑÐ] 272Çóµ÷¼Á +7 ½Å»¬µÄÊØ·¨¹«Ãñ 2026-03-27 7/350 2026-03-27 17:23 by laoshidan
[¿¼ÑÐ] 333Çóµ÷¼Á +3 questionÍì·ç 2026-03-23 3/150 2026-03-27 11:29 by ²»³Ôô~µÄ؈
[¿¼ÑÐ] 0703»¯Ñ§Ò»Ö¾Ô¸ÄϾ©Ê¦·¶´óѧ303Çóµ÷¼Á +3 zzffylgg 2026-03-24 3/150 2026-03-27 10:42 by shangxh
[¿¼ÑÐ] 081200-11408-276ѧ˶Çóµ÷¼Á +3 ´Þwj 2026-03-26 3/150 2026-03-26 19:57 by nihaoar
[¿¼ÑÐ] 086000ÉúÎïÓëÒ½Ò©292Çóµ÷¼Á +6 СС³ÂСС 2026-03-22 9/450 2026-03-26 15:58 by dick_runner
[¿¼ÑÐ] »¯Ñ§µ÷¼ÁÒ»Ö¾Ô¸ÉϺ£½»Í¨´óѧ336·Ö-±¾¿ÆÉϺ£211 +4 СÓã°®Óлú 2026-03-25 4/200 2026-03-26 10:19 by aa331100
[¿¼ÑÐ] ¡¾2026¿¼Ñе÷¼Á¡¿ÖÆÒ©¹¤³Ì 284·Ö ÇóÏà¹Ø×¨Òµµ÷¼ÁÃû¶î +4 Ô¬Û¼Û¼ 2026-03-25 8/400 2026-03-25 14:32 by lbsjt
[¿¼ÑÐ] 0854È˹¤ÖÇÄÜ·½ÏòÕÐÊÕµ÷¼Á +4 ÕÂСÓã567 2026-03-24 4/200 2026-03-25 13:29 by 2177681040
[¿¼ÑÐ] 340Çóµ÷¼Á +5 »°Ã·ÌÇ111 2026-03-24 5/250 2026-03-25 06:53 by ilovexiaobin
[¿¼ÑÐ] Ò»Ö¾Ô¸ÎäÀí085500»úеרҵ×Ü·Ö300Çóµ÷¼Á +3 an10101 2026-03-24 7/350 2026-03-25 00:00 by ɽ¹í0-
[¿¼ÑÐ] 361Çóµ÷¼Á +3 Glack 2026-03-22 3/150 2026-03-23 22:03 by fuyu_
ÐÅÏ¢Ìáʾ
ÇëÌî´¦ÀíÒâ¼û