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