MATLAB 高等数学工具箱程序

function varargout = symbol_demo(varargin)
% SYMBOL_DEMO M-file for symbol_demo.fig
% SYMBOL_DEMO, by itself, creates a new SYMBOL_DEMO or raises the existing
% singleton*.
%
% H = SYMBOL_DEMO returns the handle to a new SYMBOL_DEMO or the handle to
% the existing singleton*.
%
% SYMBOL_DEMO('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in SYMBOL_DEMO.M with the given input arguments.
%
% SYMBOL_DEMO('Property','Value',...) creates a new SYMBOL_DEMO or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before symbol_demo_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to symbol_demo_OpeningFcn via varargin.
%
% *See GUI Options _disibledevent=>
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @symbol_demo_OpeningFcn, ...
'gui_OutputFcn', @symbol_demo_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(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 symbol_demo is made visible.
function symbol_demo_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 symbol_demo (see VARARGIN)
% Choose default command line output for symbol_demo
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes symbol_demo wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = symbol_demo_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 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 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 _disibledevent=>
%等于expression=get(handles.edit1,'string');
%当前输入的expression为字符串类型,必须转换为符号表达式才可进行运算
expression=sym(expression);
%进行因式分解运算
answer=char(factor(expression)); %并将结果转换为字符串便于显示
%因为结果answer为字符串了,因此就可以直接设置在edit2中显示
set(handles.edit2,'string',answer);
% --- Executes _disibledevent=>
expression=sym(expression); %转换为符号表达式
%进行同次项合并运算
answer=char(collect(expression));%并将结果转换为字符串便于显示
%因为结果answer为字符串了,因此就可以直接设置在edit2中显示
set(handles.edit2,'string',answer);
% --- Executes _disibledevent=>
expression=sym(expression); %转换为符号表达式
%进行同次项合并运算
answer=char(diff(expression));%并将结果转换为字符串便于显示
%因为结果answer为字符串了,因此就可以直接设置在edit2中显示
set(handles.edit2,'string',answer);
% --- Executes _disibledevent=>
expression=sym(expression); %转换为符号表达式
%进行同次项合并运算
answer=char(int(expression));%并将结果转换为字符串便于显示
%因为结果answer为字符串了,因此就可以直接设置在edit2中显示
set(handles.edit2,'string',answer);
% --- Executes during object creation, after setting all properties.
function figure1_CreateFcn(hObject, eventdata, handles)
% hObject handle to figure1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% --- Executes _disibledevent=>

Tags: 

延伸阅读

最新评论

发表评论