• 大小: 9KB
    文件类型: .m
    金币: 1
    下载: 0 次
    发布日期: 2021-06-11
  • 语言: Matlab
  • 标签: 单点定位  matlab  

资源简介

用matlab写的利用卫星星历计算接收机坐标。能力有限,程序做的一般,不过可以运行。

资源截图

代码片段和文件信息

navdata=struct(‘prn‘NaN‘year‘NaN‘month‘NaN‘day‘NaN‘hour‘NaN‘minute‘NaN‘second‘NaN‘af0‘NaN‘af1‘NaN‘af2‘NaN‘aode‘NaN‘crs‘NaN‘dn‘NaN‘M0‘NaN‘cuc‘NaN‘ec‘NaN‘cus‘NaN‘sqrtA‘NaN‘toe‘NaN‘cic‘NaN‘OMEGA0‘NaN‘cis‘NaN‘i0‘NaN‘crc‘NaN‘omega‘NaN‘OMEGA‘NaN‘idt‘NaN‘cflg12‘NaN‘weekno‘NaN‘pflg12‘NaN‘svacc‘NaN‘svhlth‘NaN‘tgd‘NaN‘aodc‘NaN‘transmit‘NaN‘spare1‘NaN‘spare2‘NaN‘spare3‘NaN);

filename=uigetfile(‘*.txt‘‘打开RINEX.N格式广播星历文件‘);
fid=fopen(filename);
head_lines=0;
while 1
    head_lines=head_lines+1;
    line=fgetl(fid);
    answer=findstr(line‘END OF HEADER‘);
    if~isempty(answer)
        break
    end
end

noeph=-1;
while 1
    noeph=noeph+1;
    line=fgetl(fid);
    if line==-1
        break
    end
end
noeph=noeph/8;                           %确定接受卫星数
frewind(fid);                            %移动文件指针位置到文件的起始位置
for l=1:head_lines                       %跳过文件表头
    line=fgetl(fid);
end
for i=1:noeph
    line=fgetl(fid);
    navdata(i).prn=str2num(line(1:2));
    y=str2num(line(3:6));
    if y>79
        navdata(i).year=y+1900;
    else
        navdata(i).year=y+2000;
    end
    navdata(i).month=str2num(line(7:9));
    navdata(i).day=str2num(line(10:12));
    navdata(i).hour=str2num(line(13:15));
    navdata(i).minute=str2num(line(16:18));
    navdata(i).second=str2num(line(19:22));
    navdata(i).af0=str2num(line(23:41));
    navdata(i).af1=str2num(line(42:60));
    navdata(i).af2=str2num(line(61:79));
    line=fgetl(fid);%第二行
    navdata(i).aode=str2num(line(4:22));
    navdata(i).crs=str2num(line(23:41));
    navdata(i).dn=str2num(line(42:60));
    navdata(i).M0=str2num(line(61:79));
    line=fgetl(fid);%第三行
    navdata(i).cuc=str2num(line(4:22));
    navdata(i).ec=str2num(line(23:41));
    navdata(i).cus=str2num(line(42:60));
    navdata(i).sqrtA=str2num(line(61:79));
    line=fgetl(fid);%第四行
    navdata(i).toe=str2num(line(4:22));
    navdata(i).cic=str2num(line(23:41));
    navdata(i).OMEGA0=str2num(line(42:60));
    navdata(i).cis=str2num(line(61:79));
    line=fgetl(fid);%第五行
    navdata(i).i0=str2num(line(4:22));
    navdata(i).crc=str2num(line(23:41));
    navdata(i).omega=str2num(line(42:60));
    navdata(i).OMEGA=str2num(line(61:79));
    line=fgetl(fid);%第六行
    navdata(i).idt=str2num(line(4:22));
    navdata(i).cflg12=str2num(line(23:41));
    navdata(i).weekno=str2num(line(42:60));
    navdata(i).pflg12=str2num(line(61:79));
    line=fgetl(fid);%第七行
    navdata(i).svacc=str2num(line(4:22));
    navdata(i).svhlth=str2num(line(23:41));
    navdata(i).tgd=str2num(line(42:60));
    navdata(i).aodc=str2num(line(61:79));
    line=fgetl(fid);%地八行
    navdata(i).transmit=str2num(line(4:22));
    navdata(i).spare1=str2num(line(23:41));
    %navdata(i).spare2=str2num(line(42:60));
    %navdata(i).spare3=str2num(line(61:79));
end
status=fclose(fid);

%---------------------------------------------------

评论

共有 条评论