20251117
This commit is contained in:
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
|
||||
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
|
||||
Reference in New Issue
Block a user