Compare commits
10 Commits
49047b316d
...
477d4d1668
8
344.txt
Normal file
8
344.txt
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
点名 X(m) Y(m) H(mm) code
|
||||||
|
|
||||||
|
3 52.000 57.000 53.000 49.000 48.000 46.000 51.000 49.000 49.000 48.000 56.000 48.000 51.000 54.000 50.000 46.000 51.000 49.000 57.000 48.000 52.000 48.000 53.000 46.000 56.000 50.000 52.000 48.000 s50
|
||||||
|
63 52.000 57.000 52.000 56.000 56.000 46.000 57.000 48.000 56.000 48.000 56.000 48.000 52.000 50.000 54.000 46.000 48.000 48.000 56.000 48.000 52.000 48.000 56.000 46.000 56.000 52.000 57.000 48.000 S77
|
||||||
|
点名 X(m) Y(m) H(mm) code
|
||||||
|
|
||||||
|
3 49510.311 80362.319 405.824 s50
|
||||||
|
63 49488.908 80426.008 408.849 S77
|
||||||
24
C11_11_3.m
Normal file
24
C11_11_3.m
Normal 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
11
C11_11_4.m
Normal 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
BIN
C11_11_5.fig
Normal file
Binary file not shown.
118
C11_11_5.m
Normal file
118
C11_11_5.m
Normal 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
7
C6_6_16.m
Normal 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
8
C6_6_17.m
Normal 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
7
C6_6_18.m
Normal 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
10
COMM.m
Normal 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
|
||||||
9
a2_1_1.m
Normal file
9
a2_1_1.m
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
% 学号为24110901003
|
||||||
|
% 学号最后的非零第一位、二位数字,u=
|
||||||
|
u=3;
|
||||||
|
v=1;
|
||||||
|
% 因为比较复杂,将分子分母分开计算
|
||||||
|
m=(exp(u)+v)^2;
|
||||||
|
n=v^2-u;
|
||||||
|
result=m/n;
|
||||||
|
disp(result)
|
||||||
9
a2_1_2.m
Normal file
9
a2_1_2.m
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
% 学号为24110901003
|
||||||
|
% 学号最后的非零第一位、二位数字,u=3,v=1;
|
||||||
|
u=3;
|
||||||
|
v=1;
|
||||||
|
% 因为比较复杂,将分子分母分开计算
|
||||||
|
m=sqrt(u-3*v);
|
||||||
|
n=u*v;
|
||||||
|
result=m/n;
|
||||||
|
disp(result);
|
||||||
2
a2_3.m
Normal file
2
a2_3.m
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
A=[3,0,0,0;0,0,0,0;0,0,0,0;0,0,0,0;0,0,0,7];
|
||||||
|
B=sprank(A)
|
||||||
5
a2_5.m
Normal file
5
a2_5.m
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
% 24110901003
|
||||||
|
a=3;
|
||||||
|
b=a>5 % 表达式值为0
|
||||||
|
a(b)=sqrt(a(b)) % 值为3
|
||||||
|
a(~b)=a(~b).^2 % 值为9
|
||||||
16
a2_6.m
Normal file
16
a2_6.m
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
% 学号24110901003
|
||||||
|
% a=3,b=1,c=9;
|
||||||
|
a=3;
|
||||||
|
b=1;
|
||||||
|
c=9;
|
||||||
|
% 定义x
|
||||||
|
syms x
|
||||||
|
% 方程表达式
|
||||||
|
f=a*x^2+b*x+c;
|
||||||
|
% 用solve函数来解
|
||||||
|
solve(f==0)
|
||||||
|
% 输出如下
|
||||||
|
% ans =
|
||||||
|
%
|
||||||
|
% - (107^(1/2)*1i)/6 - 1/6
|
||||||
|
% (107^(1/2)*1i)/6 - 1/6
|
||||||
10
b3_5.m
Normal file
10
b3_5.m
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
% c取值为学号最后的非零第一位数字
|
||||||
|
c=3
|
||||||
|
switch (c)
|
||||||
|
case {1, 3, 5, 7, 9},
|
||||||
|
disp('The value is odd.');
|
||||||
|
case {2, 4, 6, 8, 10},
|
||||||
|
disp('The value is even.');
|
||||||
|
otherwise
|
||||||
|
disp('The value is out of range.');
|
||||||
|
end
|
||||||
13
b4_3.m
Normal file
13
b4_3.m
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
% 定义x,y
|
||||||
|
x=6
|
||||||
|
y=6
|
||||||
|
if (x>=0 && y>=0)
|
||||||
|
r=x+y
|
||||||
|
elseif (x>=0 && y<0)
|
||||||
|
r=x+y^2;
|
||||||
|
elseif (x<0 && y>=0)
|
||||||
|
r=x^2+y;
|
||||||
|
elseif (x<0 && y<0)
|
||||||
|
r=x^2+y^2;
|
||||||
|
end
|
||||||
|
disp(x)
|
||||||
13
c11_11_1.m
Normal file
13
c11_11_1.m
Normal 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
10
c11_11_2.m
Normal 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');
|
||||||
6
c5_5_11.m
Normal file
6
c5_5_11.m
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
x=-1:1;
|
||||||
|
y=[1,2,3,4,5;1,2,1,2,1;5,4,3,2,1];
|
||||||
|
subplot(1,2,1);bar(x,y,'grouped');
|
||||||
|
title('Grouped');axis([-3,3,0,6]);
|
||||||
|
subplot(1,2,2);barh(x,y,'stacked');
|
||||||
|
title('Stack');
|
||||||
4
c5_5_13.m
Normal file
4
c5_5_13.m
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
y=randn(500,1);
|
||||||
|
theta=y*pi;
|
||||||
|
rose(theta);
|
||||||
|
title('再极坐标下的直方图');
|
||||||
3
c5_5_14.m
Normal file
3
c5_5_14.m
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
pie([7,17,23,19,5],[0,0,0,0,1]);
|
||||||
|
title('饼图');
|
||||||
|
legend('优秀','良好','中等','及格','不及格');
|
||||||
6
c5_5_15.m
Normal file
6
c5_5_15.m
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
t=0:2*pi/8:2*pi;
|
||||||
|
t=[t,t(1)];
|
||||||
|
x=sin(t);
|
||||||
|
y=cos(t);
|
||||||
|
fill(x,y,'r');
|
||||||
|
axis equal;axis([-1.5,1.5,-1.5,1.6])
|
||||||
8
c5_5_16.m
Normal file
8
c5_5_16.m
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
x=0:0.35:7;
|
||||||
|
y=2*exp(-0.5*x);
|
||||||
|
subplot(1,3,1);scatter(x,y,'green');
|
||||||
|
title('scatter(x,y,''green'')');axis([0,7,0,2]);
|
||||||
|
subplot(1,3,2);stairs(x,y,'b');
|
||||||
|
title('stairs(x,y,''b'')');axis([0,7,0,2]);
|
||||||
|
subplot(1,3,3);stem(x,y,'k');
|
||||||
|
title('stem(x,y,''k'')');axis([0,7,0,2]);
|
||||||
8
c5_5_17.m
Normal file
8
c5_5_17.m
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
x=-pi:pi/8:pi;
|
||||||
|
y=sin(x);
|
||||||
|
subplot(2,2,1);compass(x,y);
|
||||||
|
title('罗盘图');
|
||||||
|
subplot(2,2,2);feather(x,y);
|
||||||
|
title('羽毛图');
|
||||||
|
subplot(2,1,2);quiver(x,y);
|
||||||
|
title('箭头图');
|
||||||
8
c5_5_18.m
Normal file
8
c5_5_18.m
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
t=0:pi/50:2*pi;
|
||||||
|
x=8*cos(t);
|
||||||
|
y=4*sqrt(2)*sin(t);
|
||||||
|
z=-4*sqrt(2)*sin(t);
|
||||||
|
plot3(x,y,z,'p');
|
||||||
|
title('Line in 3-D Space');
|
||||||
|
text(0,0,0,'origin');
|
||||||
|
xlabel('X'),ylabel('Y'),zlabel('Z');grid;
|
||||||
12
c5_5_20.m
Normal file
12
c5_5_20.m
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
x=0:0.1:2*pi;
|
||||||
|
[x,y]=meshgrid(x);
|
||||||
|
z=sin(y).*cos(x);
|
||||||
|
subplot(2,2,1);mesh(x,y,z);
|
||||||
|
xlabel('x-axis'),ylabel('y-axis'),zlabel('z-axis');
|
||||||
|
title('mesh');
|
||||||
|
subplot(2,2,2);surf(x,y,z);
|
||||||
|
xlabel('x-axis'),ylabel('y-axis'),zlabel('z-axis');
|
||||||
|
title('surf');
|
||||||
|
subplot(2,1,2);plot3(x,y,z);
|
||||||
|
xlabel('x-axis'),ylabel('y-axis'),zlabel('z-axis');
|
||||||
|
title('plot3');
|
||||||
18
c5_5_21.m
Normal file
18
c5_5_21.m
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
m=30;
|
||||||
|
z=1.2*(0:m)/m;
|
||||||
|
r=ones(size(z));
|
||||||
|
theta=(0:m)/m*pi*2;
|
||||||
|
x1=r'*cos(theta);
|
||||||
|
y1=r'*sin(theta);
|
||||||
|
z1=z'*ones(1,m+1);
|
||||||
|
x=(-m:2:m)/m;
|
||||||
|
x2=x'*ones(1,m+1);
|
||||||
|
y2=r'*cos(theta);
|
||||||
|
z2=r'*sin(theta);
|
||||||
|
surf(x1,y1,z1);
|
||||||
|
axis equal,axis off;
|
||||||
|
hold on;
|
||||||
|
surf(x2,y2,z2);
|
||||||
|
axis equal,axis off;
|
||||||
|
title('两个圆柱体相交图形');
|
||||||
|
hold off;
|
||||||
13
c5_5_22.m
Normal file
13
c5_5_22.m
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
[x,y] = meshgrid(-10:0.2:10);
|
||||||
|
z1 = (x.^2-2*y.^2) + eps;
|
||||||
|
a=input('a=?');
|
||||||
|
z2=a*ones(size(x));
|
||||||
|
subplot(1,2,1);
|
||||||
|
mesh(x,y,z1);hold on;mesh(x,y,z2);
|
||||||
|
v=[-10,10,-10,10,-100,100];axis(v);grid;
|
||||||
|
hold off
|
||||||
|
r0=abs(z1-z2)<=1;
|
||||||
|
xx=r0.*x;yy=r0;zz=r0.*z2;
|
||||||
|
subplot(1,2,2);
|
||||||
|
plot3(xx(r0~=0),yy(r0~=0),zz(r0~=0),'*');
|
||||||
|
axis(v);grid;
|
||||||
14
c5_5_23.m
Normal file
14
c5_5_23.m
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
[x,y]=meshgrid(-8:0.5:8);
|
||||||
|
z=sin(sqrt(x.^2+y.^2));
|
||||||
|
subplot(2,2,1);
|
||||||
|
meshc(x,y,z);
|
||||||
|
title('meshc(x,y,z)');
|
||||||
|
subplot(2,2,2);
|
||||||
|
meshz(x,y,z);
|
||||||
|
title('meshz(x,y,z)');
|
||||||
|
subplot(2,2,3);
|
||||||
|
surfc(x,y,z);
|
||||||
|
title('surfc(x,y,z)');
|
||||||
|
subplot(2,2,4);
|
||||||
|
surfl(x,y,z);
|
||||||
|
title('surfl(x,y,z)');
|
||||||
5
c5_5_24.m
Normal file
5
c5_5_24.m
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
t=0:pi/20:2*pi;
|
||||||
|
[x,y,z]=cylinder(2+sin(t),30);
|
||||||
|
subplot(1,3,1);surf(x,y,z);
|
||||||
|
[x,y,z]=sphere;
|
||||||
|
subplot(1,3,1);surf(x,y,z);
|
||||||
6
c_5_5_12.m
Normal file
6
c_5_5_12.m
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
y=randn(500,1);
|
||||||
|
subplot(1,2,1);
|
||||||
|
hist(y);title('高斯分布直方图');
|
||||||
|
x=-4:0.1:4;
|
||||||
|
subplot(1,2,2)
|
||||||
|
hist(y,x);title('指定范围的高斯分布直方图');
|
||||||
7
caidan1.m
Normal file
7
caidan1.m
Normal 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'')');
|
||||||
@@ -1,6 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
function jrad=deg2rad(deg)
|
function jrad=deg2rad(deg)
|
||||||
degd=fix(deg);
|
degd=fix(deg);
|
||||||
degf=(deg-degd)*100;
|
degf=(deg-degd)*100;
|
||||||
|
|||||||
8
difun.m
Normal file
8
difun.m
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
function y=difun(x)
|
||||||
|
if x<-pi
|
||||||
|
y=-x-pi
|
||||||
|
elseif x>-pi && x<pi
|
||||||
|
y=sin(x)
|
||||||
|
else
|
||||||
|
y=(x-pi)/2
|
||||||
|
end
|
||||||
7
dms2mat.m
Normal file
7
dms2mat.m
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
function dmsv=dms2mat(dv)
|
||||||
|
[l,c]=size(dv);
|
||||||
|
for i=1:l
|
||||||
|
dmsv(i,1)=fix(dv);
|
||||||
|
dmsv(i,2)=fix((dv-fix(dv))*60);
|
||||||
|
dmsv(i,3)=(dv-dmsv(i,1)-dmsv(i,2)*60);
|
||||||
|
end
|
||||||
BIN
image1.png
Normal file
BIN
image1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 334 KiB |
23
jianjiepingcha.m
Normal file
23
jianjiepingcha.m
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
disp('水准网间接平差')
|
||||||
|
disp('已知高程')
|
||||||
|
Ha=5.015
|
||||||
|
Hb=6.016
|
||||||
|
disp('观测高差(m)')
|
||||||
|
L=[1.359;2.009;0.363;1.012;0.657;-0.357]
|
||||||
|
disp('系数矩阵')
|
||||||
|
B=[1,0;0,1;1,0;0,1;-1,1;-1,0]
|
||||||
|
l=[0;0;4;3;7;2]
|
||||||
|
disp('C:')
|
||||||
|
C=1*ones(1,6);
|
||||||
|
S=[1.1,1.7,2.3,2.7,2.4,4.0]
|
||||||
|
P=C./S
|
||||||
|
P=diag(P)
|
||||||
|
disp('参数的解')
|
||||||
|
x=inv(B'*P*B)*B'*P*L
|
||||||
|
disp('wucha')
|
||||||
|
V=B*x-l
|
||||||
|
L1=L+V/1000
|
||||||
|
disp('jingdu')
|
||||||
|
n=6;
|
||||||
|
t=2;
|
||||||
|
delta=sqrt(V'*P*V/(n-t))
|
||||||
11
jjpc.m
Normal file
11
jjpc.m
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
function [csgz,qxx,dert0,dlj]=jjpc(bb,ll,pp)
|
||||||
|
pn=diag(pp);
|
||||||
|
nbb=bb'*pn*bb;
|
||||||
|
ww=bb'*pn*ll;
|
||||||
|
qxx=inv(nbb);
|
||||||
|
csgz=qxx*ww;
|
||||||
|
vv=bb*csgz-ll;
|
||||||
|
vtpv=ll'*pn*ll-ww'*csgz;
|
||||||
|
[rr,nn]=size(bb);
|
||||||
|
dert0=sqrt(vtpv/rr);
|
||||||
|
dlj=der0*dert0*bb*qxx*bb';
|
||||||
4
kongjian1.m
Normal file
4
kongjian1.m
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
pbstart=uicontrol(gcf,"Style","pushbutton","Position",[50,5,60,25],"String","Start Plot","Callback",...
|
||||||
|
"t=-pi:pi/20:2*pi;plot(t,sin(t))");
|
||||||
|
ptgrid=uicontrol(gcf,"Style","togglebutton","Position",[150,5,60,25],...
|
||||||
|
"String","Grid","Callback",'grid');
|
||||||
9
kongjian2.m
Normal file
9
kongjian2.m
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
set(gcf,'Color','R');
|
||||||
|
htext=uicontrol(gcf,"Style","text","String","Color Option","Position",[200,130,150,20]);
|
||||||
|
% 单选
|
||||||
|
hr=uicontrol(gcf,"Style","radiobutton","String","Red","Position",[200,100,150,25],"Value",1,...
|
||||||
|
"Callback",['set(hr,''Value'',1);','set(hb,''Value'',0);','set(hy,''Value'',0);','set(gcf,''Color'',''R'')']);
|
||||||
|
hb=uicontrol(gcf,"Style","radiobutton","String","Blue","Position",[200,75,150,25],"Value",0,...
|
||||||
|
"Callback",['set(hr,''Value'',0);','set(hb,''Value'',1);','set(hy,''Value'',0);','set(gcf,''Color'',''B'')']);
|
||||||
|
hy=uicontrol(gcf,"Style","radiobutton","String","Yellow","Position",[200,50,150,25],"Value",0,...
|
||||||
|
"Callback",['set(hy,''Value'',0);','set(hb,''Value'',0);','set(hy,''Value'',1);','set(gcf,''Color'',''Y'')']);
|
||||||
11
kongjian3.m
Normal file
11
kongjian3.m
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
htxt=uicontrol(gcf,"Style","text","Position",[200,125,150,25],"String","Set Window Properties");
|
||||||
|
hp=uicontrol(gcf,"Style","checkbox","Position",[200,100,150,25],"String","My Position",...
|
||||||
|
"Callback",["set(gcf,""Position"",[10,10,300,250];",...
|
||||||
|
"if get(hp,""Value"")==1,",...
|
||||||
|
"set(gcf,""Position"",[10,10,600,500]),",'end']);
|
||||||
|
hc=uicontrol(gcf,"Style","checkbox","Position",[200,75,150,25],"String","My Color",...
|
||||||
|
"Callback",["set(gcf,""color"",""w"");","if get(hc,""Value"")==1,","set(gcf,""color"",g]","end"]);
|
||||||
|
hn=uicontrol(gcf,"Style","checkbox","Position",[200,50,150,25],"String","My Name",...
|
||||||
|
"Callback",["set(gcf,""Name"",""未选择"";",...
|
||||||
|
"if get(hn,""Value"")==1,",...
|
||||||
|
"set(gcf,""Name"",""未选择"")","end");
|
||||||
2
kongjian4.m
Normal file
2
kongjian4.m
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
hpop=uicontrol(gcf,"Style","popup","String",'red|blue|green|yellow|white','Position',[100,100,100,80],...
|
||||||
|
'Callback',['cbcol=[''R'',''B'',''G'',''Y''];','set(gcf,''Color'',cbcol(get(hpop,''Value'')))']);
|
||||||
4
kongjian5.m
Normal file
4
kongjian5.m
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
h1=uicontrol(gcf,'Style','listbox','String','red|blue|green|yellow|white',...
|
||||||
|
'Position',[100,100,100,80],'Callback',...
|
||||||
|
['cbcol=[''r'',''b'',''g'',''y'',''w''];',...
|
||||||
|
'set(gcf,''color'',cbcol(get(h1,''Value'')))']);
|
||||||
3
kongjian6.m
Normal file
3
kongjian6.m
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
ftdir=uicontrol(gcf,'Style','frame','BackgroundColor','y','Position',[30,180,120,100]);
|
||||||
|
edmulti=uicontrol(gcf,'Style','edit','String','Matlab is a very useful Language',...
|
||||||
|
'Position',[50,200,75,55],'Max',2,'BackgroundColor','w');
|
||||||
9
kongjian7.m
Normal file
9
kongjian7.m
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
fig=figure('Position',[20,20,400,150]);
|
||||||
|
hsli1=uicontrol(fig,'Style','slider','Position',[50,50,120,20],'Min',200,'Max',800,'Value',400,...
|
||||||
|
'Callback',['set(azmcur,''String'','...
|
||||||
|
'num2str(get(hsli1,''Value'')));'...
|
||||||
|
'set(gcf,''Position'',[20,20,get(hsli1,''Value''),300]);']);
|
||||||
|
hsli2=uicontrol(fig,'Style','slider','Position',[240,50,120,20],'Min',100,'Max',600,'Value',300,...
|
||||||
|
'Callback',['set(elvcur,''String'','...
|
||||||
|
'num2str(get(hsli2,''Value'')));'...
|
||||||
|
'set(gcf,''Position'',[20,20,400,get(hsli2,''Value'')]);']);
|
||||||
59
lab1/exercise1.m
Normal file
59
lab1/exercise1.m
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
% 练习1
|
||||||
|
x=linspace(-pi,pi,21)
|
||||||
|
y=sin(x)
|
||||||
|
% 练习2
|
||||||
|
clear
|
||||||
|
k=1:1000;
|
||||||
|
kk=1./k;
|
||||||
|
kkk=kk./k;
|
||||||
|
res=sum(kkk)-(pi^2)/6
|
||||||
|
% 练习3
|
||||||
|
sum(kk-log(1000))
|
||||||
|
% 练习4
|
||||||
|
clear
|
||||||
|
a=rand(2,3)
|
||||||
|
x=a(1,:)
|
||||||
|
y=a(2,:)
|
||||||
|
norm(x)
|
||||||
|
norm(y)
|
||||||
|
acos(dot(x,y)/norm(x)/norm(y))
|
||||||
|
% 练习5
|
||||||
|
clear
|
||||||
|
rand(3)
|
||||||
|
det(ans) % 线性无关
|
||||||
|
% 练习6
|
||||||
|
clear
|
||||||
|
a=rand(3,2)
|
||||||
|
x=a(1,:)
|
||||||
|
y=a(2,:)
|
||||||
|
z=a(3,:)
|
||||||
|
alpha=x-z
|
||||||
|
beta=y-z
|
||||||
|
alpha=[alpha 0]
|
||||||
|
beta=[beta 0]
|
||||||
|
cross(alpha,beta)
|
||||||
|
% 练习7
|
||||||
|
clear
|
||||||
|
a=11:19
|
||||||
|
b=a
|
||||||
|
for k=1:8
|
||||||
|
b=[b;a+10*k];
|
||||||
|
end
|
||||||
|
rank(b)
|
||||||
|
% 练习8
|
||||||
|
y=[]
|
||||||
|
for x=-6:0.05:6
|
||||||
|
y=[y difun(x)];
|
||||||
|
end
|
||||||
|
plot(x,y)
|
||||||
|
plot([-6:0.05:6],y)
|
||||||
|
% 练习9
|
||||||
|
A=[6,2,1,-1;2,4,1,0;1,1,4,-1;-1,0,-1,3];
|
||||||
|
b=[6;1;5;-5]
|
||||||
|
x=A\b
|
||||||
|
% 练习10
|
||||||
|
[diag(1:4) eye(4)]
|
||||||
|
% 练习11
|
||||||
|
num2p(123453656345)
|
||||||
|
% 练习12
|
||||||
|
ttry(100)
|
||||||
13
lab1/lab1.m
Normal file
13
lab1/lab1.m
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
a=[2,3,6,7;4,2,8,6;3,6,9,2;4,7,9,3]
|
||||||
|
a1=a([1:3],[2:3])
|
||||||
|
a2=a(2,3)
|
||||||
|
zeros(3,4)
|
||||||
|
ones(5)
|
||||||
|
eye(3)
|
||||||
|
rand(4)
|
||||||
|
randn(3)
|
||||||
|
% 删除行列
|
||||||
|
a(:,[3])=[]
|
||||||
|
% 增加元素和列
|
||||||
|
a(5,6)=45
|
||||||
|
a(:,4)=[90,89,34,56,98]
|
||||||
7
lab2/dtor.m
Normal file
7
lab2/dtor.m
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
% 度分秒转弧度
|
||||||
|
function jrad=dtor(deg)
|
||||||
|
degd=fix(deg);
|
||||||
|
degf=(deg-degd)*100;
|
||||||
|
degm=fix(degf);
|
||||||
|
degs=(degf-degm)/36.0;
|
||||||
|
jrad=(degd+degm*60.00+degs)*pi/180;
|
||||||
25
lab2/exercise2.m
Normal file
25
lab2/exercise2.m
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
% 练习2第1-4题
|
||||||
|
% 1
|
||||||
|
A=[6,9,3;2,7,5];
|
||||||
|
B=[2,4,1;4,6,8];
|
||||||
|
A+B
|
||||||
|
A*B
|
||||||
|
A*B'
|
||||||
|
|
||||||
|
% 2
|
||||||
|
clear
|
||||||
|
A=[3,2,0,1,5];
|
||||||
|
roots(A)
|
||||||
|
|
||||||
|
% 3
|
||||||
|
clear
|
||||||
|
A = [4,9,2;7,6,4;3,5,7];
|
||||||
|
B = [37;26;28];
|
||||||
|
A\B
|
||||||
|
|
||||||
|
% 4
|
||||||
|
syms x
|
||||||
|
f = 3*x^4-12*x^3-5*x+9;
|
||||||
|
int (f,x)
|
||||||
|
diff(f,x)
|
||||||
|
int(f,x,0,2)
|
||||||
BIN
lab2/exercise2.mlx
Normal file
BIN
lab2/exercise2.mlx
Normal file
Binary file not shown.
14
lab2/exercise2_5.m
Normal file
14
lab2/exercise2_5.m
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
% 练习2第五题
|
||||||
|
subplot(1,2,1)
|
||||||
|
t=0:0.1:2*pi;
|
||||||
|
x=sin(3*t).*cos(t);
|
||||||
|
y=sin(3*t).*sin(t);
|
||||||
|
plot(x,y,'-r','Linewidth',5);
|
||||||
|
subplot(1,2,2)
|
||||||
|
y1=sin(x);
|
||||||
|
y2=sin(x).*exp(-0.1*x);
|
||||||
|
plot(x,y1,'+b',x,y2,'-g')
|
||||||
|
title('曲线y1 y2')
|
||||||
|
xlabel('变量x')
|
||||||
|
ylabel('变量y')
|
||||||
|
legend('y1','y2');
|
||||||
16
lab2/exercise2_6.m
Normal file
16
lab2/exercise2_6.m
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
x=1:10;
|
||||||
|
y=[4.9,3.3,4.2,4.2,5.7,6.5,7.7,9.4,14.7,19.0];
|
||||||
|
a=polyfit(x,y,2);
|
||||||
|
b=polyfit(x,y,3);
|
||||||
|
c=polyfit(x,y,4);
|
||||||
|
xx=1:0.1:10;
|
||||||
|
yy1=polyval(a,xx);
|
||||||
|
yy2=polyval(b,xx);
|
||||||
|
yy3=polyval(c,xx);
|
||||||
|
plot(x,y,'*b')
|
||||||
|
hold on
|
||||||
|
plot(xx,yy1,'-r',xx,yy2,'-g',xx,yy3,'-y')
|
||||||
|
title('2,3,4次曲线拟合')
|
||||||
|
xlabel('变量x')
|
||||||
|
ylabel('变量y')
|
||||||
|
legend('y','yy1','yy2','yy3')
|
||||||
16
lab2/exercise2_7.m
Normal file
16
lab2/exercise2_7.m
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
subplot(1,2,1);
|
||||||
|
x=-3:0.1:3;
|
||||||
|
y=-3:0.1:3;
|
||||||
|
z=x.*exp(-x.^2-y.^2);
|
||||||
|
plot3(x,y,z);
|
||||||
|
subplot(1,2,2);
|
||||||
|
[x,y]=meshgrid(-3:0.1:3);
|
||||||
|
z=x.*exp(-x.^2-y.^2);
|
||||||
|
surf(x,y,z);
|
||||||
|
shading interp;
|
||||||
|
colormap("spring");
|
||||||
|
k=find(x<=0 & y<=0);
|
||||||
|
z1=z;
|
||||||
|
z1(k)=NaN;
|
||||||
|
surf(x,y,z1);
|
||||||
|
shading interp;
|
||||||
3
lab2/exercise2_9.m
Normal file
3
lab2/exercise2_9.m
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
axes(handles.axes1);
|
||||||
|
[X,Y,Z]=sphere(25);
|
||||||
|
mesh(X,Y,2*(Z+1));
|
||||||
20
lab2/fn.m
Normal file
20
lab2/fn.m
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
function t=fn(n);
|
||||||
|
m=3;
|
||||||
|
t=1:n;
|
||||||
|
a=1;
|
||||||
|
j=1;
|
||||||
|
ind=0;
|
||||||
|
while a<n
|
||||||
|
while j<m
|
||||||
|
ind =ind + 1;
|
||||||
|
if ind > length(t)
|
||||||
|
ind=1;
|
||||||
|
end
|
||||||
|
j=j+1;
|
||||||
|
end
|
||||||
|
t(ind)=[]
|
||||||
|
ind=ind-1;
|
||||||
|
j=1;
|
||||||
|
a=a+1;
|
||||||
|
end
|
||||||
|
t
|
||||||
10
lab2/pmzbfs.m
Normal file
10
lab2/pmzbfs.m
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
function [raf,jl]=pmzbfs(x1,y1,x2,y2)
|
||||||
|
detx=x2-x1;dety=y2-y1;
|
||||||
|
faw1=atan(dety/detx);
|
||||||
|
j1=sqrt(detx*detx+dety*dety);
|
||||||
|
if detx<0
|
||||||
|
raf=faw1+pi;
|
||||||
|
end
|
||||||
|
if (detx>0)*(det<0)
|
||||||
|
raf=faw1+2*pi;
|
||||||
|
end
|
||||||
7
lab2/rad2deg.m
Normal file
7
lab2/rad2deg.m
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
function jdeg=rad2deg(rad)
|
||||||
|
rad=rad*180/pi;
|
||||||
|
deg=fix(rad);
|
||||||
|
xsbf=(rad-deg)*60;
|
||||||
|
degf=fix(xsbf);
|
||||||
|
degm=(xsbf-degf)*60;
|
||||||
|
jdeg=deg+degf/100.0+degm/10000.0;
|
||||||
49
lab3/createfigure.m
Normal file
49
lab3/createfigure.m
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
function createfigure(X1, Y1, xdata1, ydata1, zdata1)
|
||||||
|
%CREATEFIGURE(X1, Y1, xdata1, ydata1, zdata1)
|
||||||
|
% X1: plot x 数据的向量
|
||||||
|
% Y1: plot y 数据的向量
|
||||||
|
% XDATA1: surface xdata
|
||||||
|
% YDATA1: surface ydata
|
||||||
|
% ZDATA1: surface zdata
|
||||||
|
|
||||||
|
% 由 MATLAB 于 17-Nov-2025 11:39:30 自动生成
|
||||||
|
|
||||||
|
% 创建 figure
|
||||||
|
figure1 = figure('PaperSize',[20.99999864 29.69999902]);
|
||||||
|
|
||||||
|
% 创建 axes
|
||||||
|
axes1 = axes('Parent',figure1,...
|
||||||
|
'Position',[0.570340909090909 0.0936507936507937 0.318944805194805 0.831349206349211]);
|
||||||
|
hold(axes1,'on');
|
||||||
|
|
||||||
|
% 创建 plot
|
||||||
|
plot(X1,Y1,'DisplayName','data1','Parent',axes1);
|
||||||
|
|
||||||
|
% 取消以下行的注释以保留坐标区的 X 范围
|
||||||
|
% xlim(axes1,[-1.37272865846885 1.35932516299143]);
|
||||||
|
% 取消以下行的注释以保留坐标区的 Y 范围
|
||||||
|
% ylim(axes1,[0.35208977067959 1.03510322604466]);
|
||||||
|
box(axes1,'on');
|
||||||
|
hold(axes1,'off');
|
||||||
|
% 创建 legend
|
||||||
|
legend1 = legend(axes1,'show');
|
||||||
|
set(legend1,...
|
||||||
|
'Position',[0.666574619538538 0.424688172043011 0.139880952380952 0.0428571428571429]);
|
||||||
|
|
||||||
|
% 创建 colorbar
|
||||||
|
colorbar(axes1);
|
||||||
|
|
||||||
|
% 创建 axes
|
||||||
|
axes2 = axes('Parent',figure1,...
|
||||||
|
'Position',[0.065714222135995 0.11 0.393012722609596 0.625290174459612]);
|
||||||
|
hold(axes2,'on');
|
||||||
|
|
||||||
|
% 创建 surf
|
||||||
|
surf(xdata1,ydata1,zdata1,'Parent',axes2);
|
||||||
|
|
||||||
|
% 创建 title
|
||||||
|
title({'图一-图二'});
|
||||||
|
|
||||||
|
view(axes2,[-37.5 30]);
|
||||||
|
grid(axes2,'on');
|
||||||
|
hold(axes2,'off');
|
||||||
8
lab3/exercise3_1.m
Normal file
8
lab3/exercise3_1.m
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
% 第一题
|
||||||
|
|
||||||
|
A=[3,4,-7,-12;5,-7,4,2;1,0,8,-5;-6,5,-2,10];
|
||||||
|
B=[4;-3;9;-8];
|
||||||
|
% 系数矩阵的秩
|
||||||
|
rank(A)
|
||||||
|
% 方程的解
|
||||||
|
C = A\B
|
||||||
6
lab3/exercise3_2.m
Normal file
6
lab3/exercise3_2.m
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
% 练习3 第二题
|
||||||
|
x=-10:1:10;
|
||||||
|
y=-10:1:10;
|
||||||
|
[X,Y]=meshgrid(x,y);
|
||||||
|
Z=sin(sqrt(X.^2+Y.^2))./(sqrt(X.^2+Y.^2));
|
||||||
|
surf(X,Y,Z)
|
||||||
7
lab3/exercise3_3.m
Normal file
7
lab3/exercise3_3.m
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
num=[1];
|
||||||
|
den=[1 2 2 1];
|
||||||
|
sys=tf(num,den);
|
||||||
|
figure(1); pzmap(sys); title('零极点图');
|
||||||
|
figure(2); impulse(sys);
|
||||||
|
w=0:0.1:10*pi;
|
||||||
|
figure(3); freqs(num,den,w)
|
||||||
10
lab3/exercise3_4.m
Normal file
10
lab3/exercise3_4.m
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
subplot(2,2,2);
|
||||||
|
x=-pi/2:pi/10:pi/2;
|
||||||
|
y=sqrt(cos(x));
|
||||||
|
plot(x,y);
|
||||||
|
subplot(2,2,3);
|
||||||
|
x=-2:0.1:2;
|
||||||
|
y=-4:0.1:4;
|
||||||
|
[x,y]=meshgrid(x,y);
|
||||||
|
z=x.^2/4+y.^2/16;
|
||||||
|
surf(x,y,z)
|
||||||
42
lab3/lab3.m
Normal file
42
lab3/lab3.m
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
% 实验3
|
||||||
|
% 读取数据
|
||||||
|
[filename1,p1]=uigetfile('*.txt', '选择尼康全站仪坐标文件名');
|
||||||
|
fp=fopen(strcat(p1,filename1),'r');
|
||||||
|
i=1;bss=[];
|
||||||
|
while ~feof(fp)
|
||||||
|
line=fgetl(fp);
|
||||||
|
data=findstr(line,',');
|
||||||
|
bss(i).dh=line(1:data(1)-1);
|
||||||
|
bss(i).x=str2num(line(data(1)+1:data(2)-1));
|
||||||
|
bss(i).y=str2num(line(data(2)+1:data(3)-1));
|
||||||
|
bss(i).h=str2num(line(data(3)+1:data(4)-1));
|
||||||
|
bss(i).dm=line(data(4)+1:end);
|
||||||
|
i=i+1;
|
||||||
|
end
|
||||||
|
fclose(fp);
|
||||||
|
|
||||||
|
% 计算国家坐标系的坐标
|
||||||
|
a=3976223.453;b=39512553.524;rad=deg2rad(0.433267);
|
||||||
|
c=cos(rad);d=-sin(rad);lmd=1.000034336;
|
||||||
|
m=i-1;gjzb=[];
|
||||||
|
for i=1:m
|
||||||
|
gjzb(i).dh=bss(i).dh;
|
||||||
|
gjzb(i).dm=bss(i).dm;
|
||||||
|
gjzb(i).h=bss(i).h;
|
||||||
|
gjzb(i).x=a+lmd*(c*bss(i).x-d*bss(i).y);
|
||||||
|
gjzb(i).y=b+lmd*(d*bss(i).x+c*bss(i).y);
|
||||||
|
end
|
||||||
|
|
||||||
|
% 输出数据
|
||||||
|
[filename2,p2]=uigetfile('*.txt', '输出文件');
|
||||||
|
fn=fopen(strcat(p2,filename2),'w');
|
||||||
|
fprintf(fn,'%s\n\n',' 点名 X(m) Y(m) H(mm) code');
|
||||||
|
fclose(fp);fn=fopen(strcat(p2,filename2),'a');
|
||||||
|
for i=1:m
|
||||||
|
fprintf(fn,'%8s', gjzb(i).dh);
|
||||||
|
fprintf(fn,'%15.3f', gjzb(i).x);
|
||||||
|
fprintf(fn,'%16.3f', gjzb(i).y);
|
||||||
|
fprintf(fn,'%10.3f', gjzb(i).h);
|
||||||
|
fprintf(fn,'%8s\n', strcat(' ',gjzb(i).dm));
|
||||||
|
end
|
||||||
|
fclose(fn);
|
||||||
7
lab3/nikon.txt
Normal file
7
lab3/nikon.txt
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
3,49510.3110,80362.3190,405.8240,s50
|
||||||
|
63,49488.9080,80426.0080,408.8490,S77
|
||||||
|
164,49461.2960,80462.3610,408.9950,S77
|
||||||
|
165,49457.2500,80485.8770,409.4490,S81
|
||||||
|
166,49476.6650,80395.8870,408.1090,S66
|
||||||
|
167,49475.1380,80398.7300,408.1570,S77
|
||||||
|
298,49465.2360,80593.9700,415.1290,S99
|
||||||
BIN
lab3/untitled.jpg
Normal file
BIN
lab3/untitled.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 37 KiB |
9
lab3/zhuanhuan.txt
Normal file
9
lab3/zhuanhuan.txt
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
点名 X(m) Y(m) H(mm) code
|
||||||
|
|
||||||
|
3 4026749.416 39592285.024 405.824 s50
|
||||||
|
63 4026728.820 39592348.981 408.849 S77
|
||||||
|
164 4026701.670 39592385.683 408.995 S77
|
||||||
|
165 4026697.922 39592409.249 409.449 S81
|
||||||
|
166 4026716.196 39592319.017 408.109 S66
|
||||||
|
167 4026714.706 39592321.879 408.157 S77
|
||||||
|
298 4026707.277 39592517.236 415.129 S99
|
||||||
10
lab4/exercise4_1.m
Normal file
10
lab4/exercise4_1.m
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
c = input('请输入一个字符:', 's');
|
||||||
|
if c >= 'A' && c <= 'Z'
|
||||||
|
disp(char(abs(c) + abs('a') - abs('A')));
|
||||||
|
elseif c >= 'a' && c <= 'z'
|
||||||
|
disp(char(abs(c) - abs('a') + abs('A')));
|
||||||
|
elseif c >= '0' && c <= '9'
|
||||||
|
disp(abs(c) - abs('0'));
|
||||||
|
else
|
||||||
|
disp(c);
|
||||||
|
end
|
||||||
6
lab4/exercise4_10.m
Normal file
6
lab4/exercise4_10.m
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
mysum=0,i=1;
|
||||||
|
while(i<=100)
|
||||||
|
mysum=mysum+i
|
||||||
|
i=i+1 ;
|
||||||
|
end
|
||||||
|
mysum
|
||||||
13
lab4/exercise4_11.m
Normal file
13
lab4/exercise4_11.m
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
A=[1 2 3;4 5 6;7 8 9];
|
||||||
|
[r,c]=size(A);
|
||||||
|
% 判断并把A中大于8和小于2的元素全部调整为0
|
||||||
|
for i=1:1:r
|
||||||
|
for j=1:1:c
|
||||||
|
if (A(i,j)>8 || A(i,j)<2)
|
||||||
|
A(i,j)=0;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
% 改写
|
||||||
|
b=(A <= 8 & A >= 2); % 判断A中小于等于8和大于等于2的元素,结果是逻辑值0/1
|
||||||
|
A=A.*b %实现A中大于8和小于2的元素全部调整为0,基于矩阵的点乘
|
||||||
5
lab4/exercise4_12.m
Normal file
5
lab4/exercise4_12.m
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
x = 0:0.05:2;
|
||||||
|
y = diag(f(x).*f(x+2));
|
||||||
|
plot(x,y);
|
||||||
|
xlabel('\bfx');
|
||||||
|
ylabel('\bfy');
|
||||||
8
lab4/exercise4_13.m
Normal file
8
lab4/exercise4_13.m
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
subplot(2,2,2);
|
||||||
|
x=linspace(-pi/2,pi/2,100);
|
||||||
|
y=sqrt(cos(x));
|
||||||
|
plot(x,y);
|
||||||
|
subplot(2,2,3);
|
||||||
|
x=linspace(-2,2);
|
||||||
|
y=linspace(-4,4);
|
||||||
|
ezsurfc('x.^2/4+y.^2/16')
|
||||||
9
lab4/exercise4_14.m
Normal file
9
lab4/exercise4_14.m
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
A=input('请输入一个向量');
|
||||||
|
[m,n]=size(A);
|
||||||
|
min=A(1,n);
|
||||||
|
for i=1:n
|
||||||
|
if min>A(1,i)
|
||||||
|
min=A(1,i);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
disp(min)
|
||||||
6
lab4/exercise4_15.m
Normal file
6
lab4/exercise4_15.m
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
a=[2,3,1,2;1,3,0,1;1,-1,1,8;7,1,-2,2];
|
||||||
|
b=[8,6,1,5]';
|
||||||
|
ra=rank(a);
|
||||||
|
rb=rank([a,b]);
|
||||||
|
det(a);
|
||||||
|
xx=a\b
|
||||||
9
lab4/exercise4_16.m
Normal file
9
lab4/exercise4_16.m
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
t=linspace(0,4*pi,20);
|
||||||
|
y1=sin(t);
|
||||||
|
y2=2*cos(2*t);
|
||||||
|
plot(t,y1,'k-');
|
||||||
|
text(1.2,sin(1.2),'y1 \leftarrow','FontSize',12)
|
||||||
|
hold on;
|
||||||
|
plot(t,y2,'r--o');
|
||||||
|
text(6,1.5,'y2 \leftarrow','FontSize',12);
|
||||||
|
title('y1 and y2');
|
||||||
6
lab4/exercise4_2.m
Normal file
6
lab4/exercise4_2.m
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
a=input('a=?');
|
||||||
|
b=input('b=?');
|
||||||
|
c=input('c=?');
|
||||||
|
d=b*b-4*a*c;
|
||||||
|
x=[(-b+sqrt(d))/(2*a),(-b-sqrt(d))/(2*a)];
|
||||||
|
disp(['x1 =',num2str(x(1)),' ,x2=',num2str(x(2))]);
|
||||||
7
lab4/exercise4_3.m
Normal file
7
lab4/exercise4_3.m
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
x=input('请输入x的值:');
|
||||||
|
if x==10
|
||||||
|
y=cos(x+1)+sqrt(x*x+1);
|
||||||
|
else
|
||||||
|
y=(3^(1/2))*sqrt(x+sqrt(x));
|
||||||
|
end
|
||||||
|
y
|
||||||
6
lab4/exercise4_4.m
Normal file
6
lab4/exercise4_4.m
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
s=0;
|
||||||
|
a=[12,13,14;15,16,17;18,19,20];
|
||||||
|
for k=a
|
||||||
|
s=s+k;
|
||||||
|
end
|
||||||
|
disp(s');
|
||||||
9
lab4/exercise4_5.m
Normal file
9
lab4/exercise4_5.m
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
k=0;
|
||||||
|
for n=100:200
|
||||||
|
if rem(n,21)~=0
|
||||||
|
k=k+1;
|
||||||
|
continue
|
||||||
|
end
|
||||||
|
break;
|
||||||
|
end
|
||||||
|
k
|
||||||
9
lab4/exercise4_7.m
Normal file
9
lab4/exercise4_7.m
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
x=-2:0.2:2;
|
||||||
|
y=x.^2;
|
||||||
|
plot(x,y)
|
||||||
|
str1 = num2str(min(x));
|
||||||
|
%数字转化为字符串
|
||||||
|
str2 = num2str(max(x));
|
||||||
|
%数字转化为字符串
|
||||||
|
out = ['Value of f from ''str1'' to ''str2'' '];
|
||||||
|
xlabel(out);
|
||||||
13
lab4/exercise4_8.m
Normal file
13
lab4/exercise4_8.m
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
s1=0;s2=0;n1 =0;n2=0 ;
|
||||||
|
x=[1,-4,-8,3,10,-9,7,-3,10, 8,-5,-2,2,0];
|
||||||
|
m=length(x);
|
||||||
|
for i=1:m
|
||||||
|
if x(i)<0
|
||||||
|
s1=s1+x(i);
|
||||||
|
n1=n1+1;
|
||||||
|
else
|
||||||
|
s2=s2+x(i);
|
||||||
|
n2=n2+1;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
s1,n1 ,s2,n2,m
|
||||||
4
lab4/exercise4_9.m
Normal file
4
lab4/exercise4_9.m
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
A=[1,2;3,4];B=[1,2;1,4];
|
||||||
|
C= A*B
|
||||||
|
D= A+B
|
||||||
|
E= A.*B
|
||||||
8
lab4/f.m
Normal file
8
lab4/f.m
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
function y=f(x)
|
||||||
|
if x<=2
|
||||||
|
y=0.5*x;
|
||||||
|
elseif x>6
|
||||||
|
y=0.5;
|
||||||
|
else
|
||||||
|
y =1.5-0.25*x;
|
||||||
|
end
|
||||||
6
lab4/factor.m
Normal file
6
lab4/factor.m
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
function f=factor(n)
|
||||||
|
if n<=1
|
||||||
|
f=1;
|
||||||
|
else
|
||||||
|
f=factor(n-1)*n;
|
||||||
|
end
|
||||||
1634
lab5/all-gps.txt
Normal file
1634
lab5/all-gps.txt
Normal file
File diff suppressed because it is too large
Load Diff
8
lab5/exercise5_1.m
Normal file
8
lab5/exercise5_1.m
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
i
|
||||||
|
j
|
||||||
|
eps
|
||||||
|
inf
|
||||||
|
nan
|
||||||
|
pi
|
||||||
|
realmax
|
||||||
|
realmin
|
||||||
8
lab5/exercise5_7.m
Normal file
8
lab5/exercise5_7.m
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
x=linspace(-2*pi,2*pi,21);
|
||||||
|
y=linspace(-1.5*pi,1.5*pi,31);
|
||||||
|
[xx,yy]=meshgrid(x,y);
|
||||||
|
zz=sin(xx/2).*cos(yy);
|
||||||
|
subplot(1,2,1)
|
||||||
|
surf(xx,yy,zz);axis image;
|
||||||
|
subplot(1,2,2)
|
||||||
|
contour(xx,yy,zz);axis image;
|
||||||
12
lab5/exercise5_8.m
Normal file
12
lab5/exercise5_8.m
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
x=0:2:4*pi;
|
||||||
|
y=sin(x).*exp(-x/5);
|
||||||
|
xx=0:0.1:4*pi;
|
||||||
|
yya=interp1(x,y,xx,'nearest');
|
||||||
|
yyb=interp1(x,y,xx,'linear');
|
||||||
|
yyc=interp1(x,y,xx,'spline');
|
||||||
|
yyd=interp1(x,y,xx,'cubic');
|
||||||
|
yye=polyval(polyfit(x,y,6),x);
|
||||||
|
plot(xx,yya,xx,yyb,xx,yyd,x,y,'r*');
|
||||||
|
legend('nearest','linear','spline','cubic','source');
|
||||||
|
grid on
|
||||||
|
title('2007***07**.zhang')
|
||||||
42
lab5/lab6.m
Normal file
42
lab5/lab6.m
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
clear all;
|
||||||
|
[filename1,p1]=uigetfile('*.txt','选择尼康全站仪坐标文件名');
|
||||||
|
fp=fopen(strcat(p1,filename1),'r');
|
||||||
|
i=1;zb=[];
|
||||||
|
while ~feof(fp)
|
||||||
|
line=fgetl(fp);
|
||||||
|
my=findstr(line,',');
|
||||||
|
zb(i).dh=line(1:my(1)-1); % 点号
|
||||||
|
zb(i).x=str2num(line(my(1)+1:my(2)-1)); % X坐标
|
||||||
|
zb(i).y=str2num(line(my(2)+1:my(3)-1)); % Y坐标
|
||||||
|
zb(i).h=str2num(line(my(3)+1:my(4)-1)); % h坐标
|
||||||
|
zb(i).dm=line(my(4)+1:end); % 点名
|
||||||
|
i = i + 1;
|
||||||
|
end
|
||||||
|
fclose(fp);
|
||||||
|
|
||||||
|
% 计算国家坐标系坐标
|
||||||
|
a=3976223.453;
|
||||||
|
b=39512553.524;
|
||||||
|
rad=deg2rad(0.433267);
|
||||||
|
c=cos(rad);d=-sin(rad);lmd=1.000034336;
|
||||||
|
m=i-1;
|
||||||
|
gjzb=[];
|
||||||
|
for i=1:m;
|
||||||
|
gjzb(i).dh=zb(i).dh;
|
||||||
|
gjzb(i).dm=zb(i).dm;
|
||||||
|
gjzb(i).h=zb(i).h;
|
||||||
|
gjzb(i).x=a+lmd*(c*zb(1).x-d*zb(i).y);
|
||||||
|
gjzb(i).y=b+lmd*(d*zb(1).x+d*zb(i).y);
|
||||||
|
end
|
||||||
|
|
||||||
|
[filename2,p2]=uigetfile('*.txt','选择输出文件名');
|
||||||
|
fn=fopen(strcat(p2,filename2),'w');
|
||||||
|
fprintf(fn,'%s\n\n','点名 X(m) Y(m) H(mm) code');
|
||||||
|
for i=1:m
|
||||||
|
fprintf(fn,'%8s',gjzb(i).dh);
|
||||||
|
fprintf(fn,'%15.3f',gjzb(i).x);
|
||||||
|
fprintf(fn,'%16.3f',gjzb(i).y);
|
||||||
|
fprintf(fn,'%10.f',gjzb(i).h);
|
||||||
|
fprintf(fn,'%8s\n',gjzb(i).dm);
|
||||||
|
end
|
||||||
|
fclose(fn);
|
||||||
4
lab5/plotRaram.m
Normal file
4
lab5/plotRaram.m
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
t=linspace(0,4*pi);
|
||||||
|
x=sin(t);
|
||||||
|
y=1-cos(t)+t/10;
|
||||||
|
plot(x,y,'-or');
|
||||||
11
lab5/regPolygon.m
Normal file
11
lab5/regPolygon.m
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
function y=regPolygon(n)
|
||||||
|
R=1;
|
||||||
|
t=0:0.01:2*pi;
|
||||||
|
x=R*cos(t);
|
||||||
|
y=R*sin(t);
|
||||||
|
m=linspace(pi/2,5/2*pi,n+1);
|
||||||
|
xz=R*cos(m);
|
||||||
|
yz=R*sin(m);
|
||||||
|
hold on
|
||||||
|
plot(x,y,xz,yz);
|
||||||
|
axis equal;
|
||||||
1636
lab5/result.txt
Normal file
1636
lab5/result.txt
Normal file
File diff suppressed because it is too large
Load Diff
4
lab6/exercise6_1.m
Normal file
4
lab6/exercise6_1.m
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
A=[0,9,6;1,3,0];
|
||||||
|
B=[1,4,3;1,5,0];
|
||||||
|
A&B
|
||||||
|
A./B
|
||||||
3
lab6/exercise6_10.m
Normal file
3
lab6/exercise6_10.m
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
syms x;
|
||||||
|
eq1=x^4-4*x^3+12*x-9==0;
|
||||||
|
x=solve(eq1,x)
|
||||||
8
lab6/exercise6_8.m
Normal file
8
lab6/exercise6_8.m
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
for k=1:10
|
||||||
|
if k>6
|
||||||
|
break
|
||||||
|
else
|
||||||
|
arry(k)=k;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
disp(arry);
|
||||||
7
lab6/exercise6_9.m
Normal file
7
lab6/exercise6_9.m
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
i=2;
|
||||||
|
a=2i;
|
||||||
|
b=2*i;
|
||||||
|
c=2*sqrt(-1);
|
||||||
|
a
|
||||||
|
b
|
||||||
|
c
|
||||||
4
lab6/exercise6_c_1.m
Normal file
4
lab6/exercise6_c_1.m
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
A=[1,2,3;4:6;7:9];
|
||||||
|
C=[A;[10,11,12]];
|
||||||
|
D=C(1:3,[2,3]);
|
||||||
|
E=C(2,[1,2]);
|
||||||
9
lab6/exercise6_c_2.m
Normal file
9
lab6/exercise6_c_2.m
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
x=[0,1,0,2,0,3,0,4];
|
||||||
|
for k=1:8
|
||||||
|
if x(k)==0
|
||||||
|
x(k)=k;
|
||||||
|
else
|
||||||
|
x(k)=2*k+1;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
disp(x)
|
||||||
3
lab6/exercise6_c_3.m
Normal file
3
lab6/exercise6_c_3.m
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
syms a b c x;
|
||||||
|
s=a*x^2+b*x+c;
|
||||||
|
solve(s)
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user