This commit is contained in:
2025-11-03 11:24:09 +08:00
parent 7d58efea2f
commit 7c647fa9e0
16 changed files with 487 additions and 0 deletions

24
C11_11_3.m Normal file
View File

@@ -0,0 +1,24 @@
screen=get(0,'ScreenSize');
W=screen(3);
H=screen(4);
figure('Color',[1,1,1],'Position',[0.2*H,0.2*H,0.5*W,0.5*H],'Name','','NumberTitle','off','MenuBar','none');
hplot=uimenu(gcf,'text','&Plot');
uimenu(hplot,'text','Sine Wave','Callback',...
['t=-pi:pi/20:pi;','plot(t,sin(t));'...
'set(hgon,''Enable'',''on'');','set(hgoff,''Enable'',''on'');'...
'set(hbon,''Enable'',''on'');','set(hboff,''Enable'',''off'');']);
uimenu(hplot,'text','Cosine Wave','Callback',...
['t=-pi:pi/20:pi;','plot(t,cos(t));'...
'set(hgon,''Enable'',''on'');','set(hgoff,''Enable'',''on'');'...
'set(hbon,''Enable'',''on'');','set(hboff,''Enable'',''off'');']);
% option
hoption=uimenu(gcf,'text','&Option');
hgon=uimenu(hoption,'text','&Grid on','Callback','grid on','Enable','off');
hgoff=uimenu(hoption,'text','&Grid off','Callback','grid off','Enable','off');
hbon=uimenu(hoption,'text','&Box on','Callback','box on','Enable','off');
hboff=uimenu(hoption,'text','&Box off','Callback','box off','Enable','off');
hwincor=uimenu(hoption,'text','&Window Color','Separator','on');
uimenu(hwincor,'text','&Red','Accelerator','r','Callback','set(gcf,''color'',''R'')');
uimenu(hwincor,'text','&Blue','Accelerator','b','Callback','set(gcf,''color'',''b'')');
uimenu(hwincor,'text','&Yellow','Accelerator','y','Callback','set(gcf,''color'',''y'')');
uimenu(hwincor,'text','&White','Accelerator','w','Callback','set(gcf,''color'',''w'')');

11
C11_11_4.m Normal file
View File

@@ -0,0 +1,11 @@
x=0:pi/100:2*pi;
y=2*exp(-0.5*x).*sin(2*pi*x);
h1=plot(x,y);
hc=uicontextmenu;
h1s=uimenu(hc,'Text','线');
h1w=uimenu(hc,'Text','线');
uimenu(h1s,'Text','线','Callback','set(h1,''LineStyle'','':'');');
uimenu(h1s,'Text','线','Callback','set(h1,''LineStyle'',''-'');');
uimenu(h1w,'Text','','Callback','set(h1,''LineWidth'',2);');
uimenu(h1w,'Text','','Callback','set(h1,''LineWidth'',0.5);');
set(h1,'UIContextMenu',hc)

BIN
C11_11_5.fig Normal file

Binary file not shown.

118
C11_11_5.m Normal file
View File

@@ -0,0 +1,118 @@
function varargout = C11_11_5(varargin)
% C11_11_5 MATLAB code for C11_11_5.fig
% C11_11_5, by itself, creates a new C11_11_5 or raises the existing
% singleton*.
%
% H = C11_11_5 returns the handle to a new C11_11_5 or the handle to
% the existing singleton*.
%
% C11_11_5('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in C11_11_5.M with the given input arguments.
%
% C11_11_5('Property','Value',...) creates a new C11_11_5 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before C11_11_5_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to C11_11_5_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 C11_11_5
% Last Modified by GUIDE v2.5 31-Oct-2025 11:38:36
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @C11_11_5_OpeningFcn, ...
'gui_OutputFcn', @C11_11_5_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 C11_11_5 is made visible.
function C11_11_5_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 C11_11_5 (see VARARGIN)
headles.peaks
% Choose default command line output for C11_11_5
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes C11_11_5 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = C11_11_5_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 pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in Contour3.
function Contour3_Callback(hObject, eventdata, handles)
% hObject handle to Contour3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on selection change in ChooseFun.
function ChooseFun_Callback(hObject, eventdata, handles)
% hObject handle to ChooseFun (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns ChooseFun contents as cell array
% contents{get(hObject,'Value')} returns selected item from ChooseFun
% --- Executes during object creation, after setting all properties.
function ChooseFun_CreateFcn(hObject, eventdata, handles)
% hObject handle to ChooseFun (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: listbox controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

7
C6_6_16.m Normal file
View File

@@ -0,0 +1,7 @@
x=0.46:0.01:0.49;
f=[0.4846555,0.4937542,0.5027498,0.5116683];
format long
interp1(x,f,0.472)
interp1(x,f,0.472,'nearest');
interp1(x,f,0.472,'pchip');
interp1(x,f,0.472,'spline');

8
C6_6_17.m Normal file
View File

@@ -0,0 +1,8 @@
x=0:0.1:1;
y=0:0.2:2;
[X,Y]=meshgrid(x,y);
z=X.^2+Y.^2;
interp2(x,y,z,0.5,0.5)
interp2(x,y,z,[0.5,0.6],0.5)
interp2(x,y,z,[0.5,0.6]',[0.4,0.5])
interp2(x,y,z,[0.5,0.6]',[0.4,0.5],'spline')

7
C6_6_18.m Normal file
View File

@@ -0,0 +1,7 @@
d=0:2.5:10;
t=(0:30:60)';
c=[95,14,0,0,0;88,48,32,12,6;67,64,54,48,41];
di=0:2:10;
ti=(0:20:60)';
ci=interp2(d,t,c,di,ti)
surf(di,ti,ci);

10
COMM.m Normal file
View File

@@ -0,0 +1,10 @@
function COMM(hedit,hpopup,hlist)
com=get(hedit,'String');
n1=get(hpopup,'Value');
n2=get(hlist,'Value');
if ~isempty(com)
chpop={'spring','summer','autumn','winter'};
chlist={'grid on','grid off','box on','box off'};
colormap(eval(chpop{n1}));
eval(chlist{n2});
end

BIN
app1.mlapp Normal file

Binary file not shown.

13
c11_11_1.m Normal file
View File

@@ -0,0 +1,13 @@
hf=figure('Color',[0,1,1],'Position',[100,200,400,200],'Name','','NumberTitle','off','MenuBar','none');
uicontrol(hf,'Style','text','Position',[80,160,40,20],'HorizontalAlignment','center','String','','BackgroundColor',[0,1,1]);
uicontrol(hf,'Style','text','Position',[280,160,40,20],'HorizontalAlignment','center','String','','BackgroundColor',[0,1,1]);
uicontrol(hf,'Style','frame','Position',[20,65,165,90],'BackgroundColor',[1,1,0]);
uicontrol(hf,'Style','text','Position',[25,110,85,25],'HorizontalAlignment','center','String','','BackgroundColor',[1,1,0]);
uicontrol(hf,'Style','text','Position',[25,75,85,25],'HorizontalAlignment','center','String','2~16','BackgroundColor',[1,1,0]);
he1=uicontrol(hf,'Style','edit','Position',[110,115,60,25],'BackgroundColor',[0,1,0]);
he2=uicontrol(hf,'Style','edit','Position',[110,80,60,25],'BackgroundColor',[0,1,0]);
uicontrol(hf,'Style','frame','Position',[215,65,165,90],'BackgroundColor',[1,1,0]);
ht=uicontrol(hf,'Style','text','Position',[255,95,90,30],'HorizontalAlignment','center','BackgroundColor',[0,1,0]);
COMM=['n=str2num(get(he1,''string''));','b=str2num(get(he2,''string''));','dec=trdec(n,b);','set(ht,''string'',dec);'];
uicontrol(hf,'Style','pushbutton','Position',[55,20,90,25],'String',' ','Callback',COMM);
uicontrol(hf,'Style','pushbutton','Position',[255,20,90,30],'String','退 ','Callback','close(hf)');

10
c11_11_2.m Normal file
View File

@@ -0,0 +1,10 @@
clf;
set(gcf,'Unit','normalized','Position',[0.2,0.3,0.5,0.40]);
set(gcf,'Menubar','none','Name','','NumberTitle','off');
axes('Position',[0.05,0.15,0.5,0.8]);
uicontrol(gcf,'Style','text','Units','normalized','Position',[0.60,0.85,0.2,0.1],'String','','HorizontalAlignment','center');
hedit=uicontrol(gcf,'Style','edit','Units','normalized','Position',[0.60,0.15,0.2,0.68],'Max',2);
hpopup=uicontrol(gcf,'Style','popupmenu','Units','normalized','Position',[0.83,0.8,0.15,0.15],'String','spring|summer|autumn|winter','Callback','COMM(hedit,hpopup,hlist)');
hlist=uicontrol(gcf,'Style','listbox','Units','normalized','Position',[0.83,0.55,0.15,0.15],'String','Grid on|Grid off|Box on|Box off','Callback','COMM(hedit,hpopup,hlist)');
hpush1=uicontrol(gcf,'Style','pushbutton','Units','normalized','Position',[0.83,0.35,0.15,0.15],'String','Draw','Callback','COMM(hedit,hpopup,hlist)');
hpush2=uicontrol(gcf,'Style','pushbutton','Units','normalized','Position',[0.83,0.15,0.15,0.15],'String',' ','Callback','close all');

7
caidan1.m Normal file
View File

@@ -0,0 +1,7 @@
screen=get(0,'ScreenSize');
W=screen(3);
H=screen(4);
hf=figure('Color',[1,1,1],'Position',[1,1,0.4*W,0.3*H],'Name','1','NumberTitle','off','MenuBar','none');
hfile=uimenu(hf,"Text",'&File');
hhelp=uimenu(hf,"Text",'&Help');
uimenu(hfile,'Text','&New','Call','disp(''New item'')');

BIN
s1.fig Normal file

Binary file not shown.

250
s1.m Normal file
View File

@@ -0,0 +1,250 @@
function varargout = s1(varargin)
% S1 MATLAB code for s1.fig
% S1, by itself, creates a new S1 or raises the existing
% singleton*.
%
% H = S1 returns the handle to a new S1 or the handle to
% the existing singleton*.
%
% S1('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in S1.M with the given input arguments.
%
% S1('Property','Value',...) creates a new S1 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before s1_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to s1_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 s1
% Last Modified by GUIDE v2.5 31-Oct-2025 11:30:04
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @s1_OpeningFcn, ...
'gui_OutputFcn', @s1_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 s1 is made visible.
function s1_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 s1 (see VARARGIN)
% Choose default command line output for s1
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes s1 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = s1_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 pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in togglebutton1.
function togglebutton1_Callback(hObject, eventdata, handles)
% hObject handle to togglebutton1 (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 togglebutton1
% --- Executes on button press in radiobutton1.
function radiobutton1_Callback(hObject, eventdata, handles)
% hObject handle to radiobutton1 (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 radiobutton1
% --- Executes on button press in radiobutton2.
function radiobutton2_Callback(hObject, eventdata, handles)
% hObject handle to radiobutton2 (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 radiobutton2
% --- Executes on button press in checkbox1.
function checkbox1_Callback(hObject, eventdata, handles)
% hObject handle to checkbox1 (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 checkbox1
% --- Executes on button press in checkbox2.
function checkbox2_Callback(hObject, eventdata, handles)
% hObject handle to checkbox2 (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 checkbox2
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 on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on selection change in popupmenu1.
function popupmenu1_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu1 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu1
% --- Executes during object creation, after setting all properties.
function popupmenu1_CreateFcn(hObject, eventdata, handles)
% hObject handle to popupmenu1 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on selection change in listbox1.
function listbox1_Callback(hObject, eventdata, handles)
% hObject handle to listbox1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns listbox1 contents as cell array
% contents{get(hObject,'Value')} returns selected item from listbox1
% --- Executes during object creation, after setting all properties.
function listbox1_CreateFcn(hObject, eventdata, handles)
% hObject handle to listbox1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: listbox controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --------------------------------------------------------------------
function PlotMenu_Callback(hObject, eventdata, handles)
% hObject handle to PlotMenu (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function Untitled_2_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function Untitled_3_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function sinewave_Callback(hObject, eventdata, handles)
% hObject handle to sinewave (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function Untitled_6_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function coswave_Callback(hObject, eventdata, handles)
% hObject handle to coswave (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function Untitled_7_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

16
trdec.m Normal file
View File

@@ -0,0 +1,16 @@
function dec=trdec(n,b)
ch1='0123456789ABCDEF';
k=1;
while n~=0
p(k)=rem(n,b);
n=fix(n/b);
k=k+1
end
k=k-1;
strdec='';
while k>=1
kb=p(k);
strdec=strcat(strdec,ch1(kb+1:kb+1));
k=k-1;
end
dec=strdec;

6
tui.m Normal file
View File

@@ -0,0 +1,6 @@
time=[0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7,7.5,8,8.5,9,9.5];
temperture=[50.4,49.5,48.6,47.9,47,46.2,45.6,44.9,44.1,43.3,42.3,41.6,40.8,40.1,39.4,38.9,38.2,37.5,36.8,35.9];
P=polyfit(time, temperture, 3);
xi=0:.2:10;
yi= polyval(P, xi);
plot(xi,yi,time,temperture,'r*');