This commit is contained in:
2025-11-17 11:16:02 +08:00
Unverified
parent 4bd2d87fc4
commit 1b3b07a7f6
35 changed files with 454 additions and 0 deletions
+8
View 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
View 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
+2
View File
@@ -0,0 +1,2 @@
function radv=dms2rad(dms)
radv=dms*pi/180;
+23
View 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
View 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';
+3
View File
@@ -0,0 +1,3 @@
bbb=[]
lll=[]
quan=[]
+13
View 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]
+59
View 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)
+7
View 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
View File
@@ -0,0 +1,25 @@
% 21-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)
Binary file not shown.
+14
View 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
View 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
View 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
View File
@@ -0,0 +1,3 @@
axes(handles.axes1);
[X,Y,Z]=sphere(25);
mesh(X,Y,2*(Z+1));
+20
View 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
View 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
View 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;
+8
View 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
View 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
View 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
View 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
View 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
View 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
+9
View 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
+5
View File
@@ -0,0 +1,5 @@
function dmsv=mat2dms(D)
[l,c]=size(D);
for i=1:l
dmsv(i)=D(i,1)+D(1,2)/60+D(i,3)/3600;
end
+8
View File
@@ -0,0 +1,8 @@
function a=num2p(n)
strr=num2str(n);
index=size(strr);
indexx=index(2);
a=[];
for k=indexx-1:-1:0
a=[a rem(fix(n/(10^k)),10)];
end
BIN
View File
Binary file not shown.
+2
View File
@@ -0,0 +1,2 @@
function radv=rad2dms(dv)
radv=rem(dv*pi/180,2*pi);
+31
View File
@@ -0,0 +1,31 @@
clc
disp('2')
disp('')
L1=[42,12,20]
L2=[78,9,9]
L3=[59,38,40]
L=[L1;L2;L3]
disp('')
% LL=dms2rad(mat2dms(L));
% A=[1,1,1];
% w=sum(LL(:))-pi;
% w=dms2mat(rad2dms(w));
% P=eye(3);
% Naa=A*inv(P)*A';
% Ka=-inv(Naa)*w;
% V=A'*Ka;
% L1=L+V;
% LL=dms2rad(mat2dms(L1));
% sumLL=sum(LL);
% if (abs(sum(LL)-pi)<1e-4)
% disp('')
% else
% disp('')
% end
SumLL=tjpc(L);
if (abs(SumLL-pi)<1e-4)
disp('')
else
disp('')
end
+12
View File
@@ -0,0 +1,12 @@
function sumLL=tjpc(L)
LL=dms2rad(mat2dms(L))
A=[1,1,1];
w=sum(LL(:))-pi;
w=dms2mat(rad2dms(w));
P=eye(3);
Naa=A*inv(P)*A';
Ka=-inv(Naa)*w;
V=A'*Ka;
L1=L+V;
LL=dms2rad(mat2dms(L1));
sumLL=sum(LL);
+7
View File
@@ -0,0 +1,7 @@
function ppi=ttry(n)
pointx=-1+2*rand(1,n);
pointy=-1+2*rand(1,n);
index=pointx.*pointx+pointy.*pointy
indexx=index<=1;
ppi=4*sum(indexx)/n
end
+10
View File
@@ -0,0 +1,10 @@
A=[1,1,1];
L=[1,2,2];
H=[1.003,0.501,-0.503];
w=7;
P=diag(2./L);
P1=inv(P);
N=A*P1*A';
Ka=7/N*8;
V=P1*A'*Ka;
h=V'+H
+30
View File
@@ -0,0 +1,30 @@
clc
clear
h1=-1.004;
h2=1.516;
h3=2.512;
h4=1.520;
HA=12.013;
HB=10.013;
h=[h1,h2,h3,h4]'
s1=2;
s2=1;
s3=2;
s4=1.5;
s=[s1,s2,s3,s4]'
A=[1,1,-1,0;0,1,1,-1];
w1=h1+h2-h3+Ha-HB;
w2=h2-h4;
w=[w1;w2];
P=diag(1./S)
Naa=A*inv(P)*A';
Ka=-inv(P)*A'*Ka;
H=h+V;
if H(1,1)+H(2,1)-H(3,1)+HA-HB == 0 && H(2,1)-H(4,1)==0
disp('')
else
disp('')
end
disp('');
HC=HA+H(1,1)
HD=HA+H(1,1)+H(4,1)
+16
View File
@@ -0,0 +1,16 @@
function f=veryfun(n)
if n==6174
return
else
index(1)=(n-rem(n,1000))/1000;
index(2)=fix(n/100)-index(1)*10;
index(3)=rem(fix(n/10),10);
index(4)=rem(n,10);
index2=sort(index,'ascend');
index3=sort(index,'descend');
a=[1000 100 10 1];
max1=index3*(a');
min1=index2*(a');
max1-min1
veryfun(max1-min1)
end