【卫星】 GNSS(比如 GPS)接收机在多径环境下的伪距测量误差附matlab代码

✅作者简介:热爱科研的Matlab仿真开发者,擅长数据处理、建模仿真、程序设计、完整代码获取、论文复现及科研仿真。

🍎 往期回顾关注个人主页:Matlab科研工作室

🍊个人信条:格物致知,完整Matlab代码获取及仿真咨询内容私信。

🔥 内容介绍

GNSS(如 GPS、北斗、Galileo)伪距测量的核心是通过接收机与卫星之间的信号传播时间计算几何距离,进而解算载体位置。但在多径环境(信号经建筑物、地面、水面等反射后到达接收机)中,反射信号与直接信号叠加,会导致伪距测量值偏离真实几何距离,形成多径误差,这是 GNSS 定位中最主要的误差源之一,严重影响定位精度与稳定性。

⛳️ 运行结果

📣 部分代码

function acqResults = acquisition(longSignal, settings)

%Function performs cold start acquisition on the collected "data". It

%searches for GPS signals of all satellites, which are listed in field

%"acqSatelliteList" in the settings structure. Function saves code phase

%and frequency of the detected signals in the "acqResults" structure.

%

%acqResults = acquisition(longSignal, settings)

%

% Inputs:

% longSignal - 11 ms of raw signal from the front-end

% settings - Receiver settings. Provides information about

% sampling and intermediate frequencies and other

% parameters including the list of the satellites to

% be acquired.

% Outputs:

% acqResults - Function saves code phases and frequencies of the

% detected signals in the "acqResults" structure. The

% field "carrFreq" is set to 0 if the signal is not

% detected for the given PRN number.

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

% SoftGNSS v3.0

%

% Copyright (C) Darius Plausinaitis and Dennis M. Akos

% Written by Darius Plausinaitis and Dennis M. Akos

% Based on Peter Rinder and Nicolaj Bertelsen

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

%This program is free software; you can redistribute it and/or

%modify it under the terms of the GNU General Public License

%as published by the Free Software Foundation; either version 2

%of the License, or (at your option) any later version.

%

%This program is distributed in the hope that it will be useful,

%but WITHOUT ANY WARRANTY; without even the implied warranty of

%MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

%GNU General Public License for more details.

%

%You should have received a copy of the GNU General Public License

%along with this program; if not, write to the Free Software

%Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,

%USA.

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

%CVS record:

%$Id: acquisition.m,v 1.1.2.12 2006/08/14 12:08:03 dpl Exp $

%% Initialization =========================================================

% Find number of samples per spreading code

samplesPerCode = round(settings.samplingFreq / ...

(settings.codeFreqBasis / settings.codeLength));

% Create two 1msec vectors of data to correlate with and one with zero DC

signal1 = longSignal(1 : samplesPerCode);

signal2 = longSignal(samplesPerCode+1 : 2*samplesPerCode);

signal0DC = longSignal - mean(longSignal); %%Problems here....

% Find sampling period

ts = 1 / settings.samplingFreq;

% Find phase points of the local carrier wave

phasePoints = (0 : (samplesPerCode-1)) * 2 * pi * ts;

% Number of the frequency bins for the given acquisition band

numberOfFrqBins = round( (settings.acqSearchBand*1000) / settings.acqSearchBin) + 1;

% Generate all C/A codes and sample them according to the sampling freq.

caCodesTable = makeCaTable(settings);

%--- Initialize arrays to speed up the code -------------------------------

% Search results of all frequency bins and code shifts (for one satellite)

results = zeros(numberOfFrqBins, samplesPerCode);

% Carrier frequencies of the frequency bins

frqBins = zeros(1, numberOfFrqBins);

%--- Initialize acqResults ------------------------------------------------

% Carrier frequencies of detected signals

acqResults.carrFreq = zeros(1, 32);

% C/A code phases of detected signals

acqResults.codePhase = zeros(1, 32);

% Correlation peak ratios of the detected signals

acqResults.peakMetric = zeros(1, 32);

fprintf('(');

% Perform search for all listed PRN numbers ...

for PRN = settings.acqSatelliteList

%% Correlate signals ======================================================

%--- Perform DFT of C/A code ------------------------------------------

caCodeFreqDom = conj(fft(caCodesTable(PRN, :)));

%--- Make the correlation for whole frequency band (for all freq. bins)

for frqBinIndex = 1:numberOfFrqBins

%--- Generate carrier wave frequency grid -------------------------

frqBins(frqBinIndex) = settings.IF - ...

(settings.acqSearchBand/2) * 1000 + ...

settings.acqSearchBin * (frqBinIndex - 1);

%--- Generate local sine and cosine -------------------------------

sigCarr = exp(1i*frqBins(frqBinIndex) * phasePoints);

%--- "Remove carrier" from the signal -----------------------------

I1 = real(sigCarr .* signal1);

Q1 = imag(sigCarr .* signal1);

I2 = real(sigCarr .* signal2);

Q2 = imag(sigCarr .* signal2);

%--- Convert the baseband signal to frequency domain --------------

IQfreqDom1 = fft(I1 + 1j*Q1);

IQfreqDom2 = fft(I2 + 1j*Q2);

%--- Multiplication in the frequency domain (correlation in time

%domain)

convCodeIQ1 = IQfreqDom1 .* caCodeFreqDom;

convCodeIQ2 = IQfreqDom2 .* caCodeFreqDom;

%--- Perform inverse DFT and store correlation results ------------

acqRes1 = abs(ifft(convCodeIQ1)) .^ 2;

acqRes2 = abs(ifft(convCodeIQ2)) .^ 2;

%--- Check which msec had the greater power and save that, will

%"blend" 1st and 2nd msec but will correct data bit issues

if (max(acqRes1) > max(acqRes2))

results(frqBinIndex, :) = acqRes1;

else

results(frqBinIndex, :) = acqRes2;

end

end % frqBinIndex = 1:numberOfFrqBins

% figure;

% mesh(results);

%% Look for correlation peaks in the results ==============================

% Find the highest peak and compare it to the second highest peak

% The second peak is chosen not closer than 1 chip to the highest peak

%--- Find the correlation peak and the carrier frequency --------------

[~, frequencyBinIndex] = max(max(results, [], 2));

%--- Find code phase of the same correlation peak ---------------------

[peakSize, codePhase] = max(max(results));

%--- Find 1 chip wide C/A code phase exclude range around the peak ----

samplesPerCodeChip = round(settings.samplingFreq / settings.codeFreqBasis);

excludeRangeIndex1 = codePhase - samplesPerCodeChip;

excludeRangeIndex2 = codePhase + samplesPerCodeChip;

%--- Correct C/A code phase exclude range if the range includes array

%boundaries

if excludeRangeIndex1 < 2

codePhaseRange = excludeRangeIndex2 : ...

(samplesPerCode + excludeRangeIndex1);

elseif excludeRangeIndex2 > samplesPerCode % PHAHN was >=

codePhaseRange = (excludeRangeIndex2 - samplesPerCode) : ...

excludeRangeIndex1;

elseif excludeRangeIndex2 == samplesPerCode % PHAHN was >=

% codePhaseRange = (excludeRangeIndex2 - samplesPerCode) : ...

% excludeRangeIndex1;

codePhaseRange = [excludeRangeIndex2, 1 : ...

excludeRangeIndex1];

else

codePhaseRange = [1:excludeRangeIndex1, ...

excludeRangeIndex2 : samplesPerCode];

end

%--- Find the second highest correlation peak in the same freq. bin ---

secondPeakSize = max(results(frequencyBinIndex, codePhaseRange));

%--- Store result -----------------------------------------------------

acqResults.peakMetric(PRN) = peakSize/secondPeakSize;

% If the result is above threshold, then there is a signal ...

if acqResults.peakMetric(PRN) > settings.acqThreshold

%% Fine resolution frequency search =======================================

%--- Indicate PRN number of the detected signal -------------------

fprintf('%02d ', PRN);

%--- Generate 10msec long C/A codes sequence for given PRN --------

caCode = generateCAcode(PRN);

codeValueIndex = floor((ts * (1:10*samplesPerCode)) / ...

(1/settings.codeFreqBasis));

longCaCode = caCode((rem(codeValueIndex, 1023) + 1));

%--- Remove C/A code modulation from the original signal ----------

% (Using detected C/A code phase)

xCarrier = ...

signal0DC(codePhase:(codePhase + 10*samplesPerCode-1)) ...

.* longCaCode;

%--- Compute the magnitude of the FFT, find maximum and the

%associated carrier frequency

%--- Find the next highest power of two and increase by 8x --------

fftNumPts = 8*(2^(nextpow2(length(xCarrier))));

%--- Compute the magnitude of the FFT, find maximum and the

%associated carrier frequency

fftxc = abs(fft(xCarrier, fftNumPts));

uniqFftPts = ceil((fftNumPts + 1) / 2);

[~, fftMaxIndex] = max(fftxc);

fftFreqBins = (0 : uniqFftPts-1) * settings.samplingFreq/fftNumPts;

if (fftMaxIndex > uniqFftPts) %and should validate using complex data

if (rem(fftNumPts,2)==0) %even number of points, so DC and Fs/2 computed

fftFreqBinsRev=-fftFreqBins((uniqFftPts-1):-1:2);

[~, fftMaxIndex] = max(fftxc((uniqFftPts+1):length(fftxc)));

acqResults.carrFreq(PRN) = -fftFreqBinsRev(fftMaxIndex);

else %odd points so only DC is not included

fftFreqBinsRev=-fftFreqBins((uniqFftPts):-1:2);

[~, fftMaxIndex] = max(fftxc((uniqFftPts+1):length(fftxc)));

acqResults.carrFreq(PRN) = fftFreqBinsRev(fftMaxIndex);

end

else

acqResults.carrFreq(PRN) = (-1)^(settings.fileType-1)*fftFreqBins(fftMaxIndex);

end

acqResults.codePhase(PRN) = codePhase;

if(abs(acqResults.carrFreq(PRN)-settings.IF)>=10000)

%warning(['carrFreq for ' num2str(PRN) ' exceeds 10kHz. Skipping for now. May be bug in code?'])

acqResults.peakMetric(PRN) = -1.;

end

else

%--- No signal with this PRN --------------------------------------

fprintf('. ');

end % if (peakSize/secondPeakSize) > settings.acqThreshold

end % for PRN = satelliteList

%=== Acquisition is over ==================================================

fprintf(')\n');

🔗 参考文献

🎈 部分理论引用网络文献,若有侵权联系博主删除

 👇 关注我领取海量matlab电子书和数学建模资料 

🏆团队擅长辅导定制多种科研领域MATLAB仿真,助力科研梦:

🌟 各类智能优化算法改进及应用
生产调度、经济调度、装配线调度、充电优化、车间调度、发车优化、水库调度、三维装箱、物流选址、货位优化、公交排班优化、充电桩布局优化、车间布局优化、集装箱船配载优化、水泵组合优化、解医疗资源分配优化、设施布局优化、可视域基站和无人机选址优化、背包问题、 风电场布局、时隙分配优化、 最佳分布式发电单元分配、多阶段管道维修、 工厂-中心-需求点三级选址问题、 应急生活物质配送中心选址、 基站选址、 道路灯柱布置、 枢纽节点部署、 输电线路台风监测装置、 集装箱调度、 机组优化、 投资优化组合、云服务器组合优化、 天线线性阵列分布优化、CVRP问题、VRPPD问题、多中心VRP问题、多层网络的VRP问题、多中心多车型的VRP问题、 动态VRP问题、双层车辆路径规划(2E-VRP)、充电车辆路径规划(EVRP)、油电混合车辆路径规划、混合流水车间问题、 订单拆分调度问题、 公交车的调度排班优化问题、航班摆渡车辆调度问题、选址路径规划问题、港口调度、港口岸桥调度、停机位分配、机场航班调度、泄漏源定位、冷链、时间窗、多车场等、选址优化、港口岸桥调度优化、交通阻抗、重分配、停机位分配、机场航班调度、通信上传下载分配优化
🌟 机器学习和深度学习时序、回归、分类、聚类和降维

2.1 bp时序、回归预测和分类

2.2 ENS声神经网络时序、回归预测和分类

2.3 SVM/CNN-SVM/LSSVM/RVM支持向量机系列时序、回归预测和分类

2.4 CNN|TCN|GCN卷积神经网络系列时序、回归预测和分类

2.5 ELM/KELM/RELM/DELM极限学习机系列时序、回归预测和分类
2.6 GRU/Bi-GRU/CNN-GRU/CNN-BiGRU门控神经网络时序、回归预测和分类

2.7 ELMAN递归神经网络时序、回归\预测和分类

2.8 LSTM/BiLSTM/CNN-LSTM/CNN-BiLSTM/长短记忆神经网络系列时序、回归预测和分类

2.9 RBF径向基神经网络时序、回归预测和分类

2.10 DBN深度置信网络时序、回归预测和分类
2.11 FNN模糊神经网络时序、回归预测
2.12 RF随机森林时序、回归预测和分类
2.13 BLS宽度学习时序、回归预测和分类
2.14 PNN脉冲神经网络分类
2.15 模糊小波神经网络预测和分类
2.16 时序、回归预测和分类
2.17 时序、回归预测预测和分类
2.18 XGBOOST集成学习时序、回归预测预测和分类
2.19 Transform各类组合时序、回归预测预测和分类
方向涵盖风电预测、光伏预测、电池寿命预测、辐射源识别、交通流预测、负荷预测、股价预测、PM2.5浓度预测、电池健康状态预测、用电量预测、水体光学参数反演、NLOS信号识别、地铁停车精准预测、变压器故障诊断
🌟图像处理方面
图像识别、图像分割、图像检测、图像隐藏、图像配准、图像拼接、图像融合、图像增强、图像压缩感知
🌟 路径规划方面
旅行商问题(TSP)、车辆路径问题(VRP、MVRP、CVRP、VRPTW等)、无人机三维路径规划、无人机协同、无人机编队、机器人路径规划、栅格地图路径规划、多式联运运输问题、 充电车辆路径规划(EVRP)、 双层车辆路径规划(2E-VRP)、 油电混合车辆路径规划、 船舶航迹规划、 全路径规划规划、 仓储巡逻、公交车时间调度、水库调度优化、多式联运优化
🌟 无人机应用方面
无人机路径规划、无人机控制、无人机编队、无人机协同、无人机任务分配、无人机安全通信轨迹在线优化、车辆协同无人机路径规划、
🌟 通信方面
传感器部署优化、通信协议优化、路由优化、目标定位优化、Dv-Hop定位优化、Leach协议优化、WSN覆盖优化、组播优化、RSSI定位优化、水声通信、通信上传下载分配
🌟 信号处理方面
信号识别、信号加密、信号去噪、信号增强、雷达信号处理、信号水印嵌入提取、肌电信号、脑电信号、信号配时优化、心电信号、DOA估计、编码译码、变分模态分解、管道泄漏、滤波器、数字信号处理+传输+分析+去噪、数字信号调制、误码率、信号估计、DTMF、信号检测
🌟电力系统方面
微电网优化、无功优化、配电网重构、储能配置、有序充电、MPPT优化、家庭用电、电/冷/热负荷预测、电力设备故障诊断、电池管理系统(BMS)SOC/SOH估算(粒子滤波/卡尔曼滤波)、 多目标优化在电力系统调度中的应用、光伏MPPT控制算法改进(扰动观察法/电导增量法)、电动汽车充放电优化、微电网日前日内优化、储能优化、家庭用电优化、供应链优化
🌟 元胞自动机方面
交通流 人群疏散 病毒扩散 晶体生长 金属腐蚀
🌟 雷达方面
卡尔曼滤波跟踪、航迹关联、航迹融合、SOC估计、阵列优化、NLOS识别
🌟 车间调度
零等待流水车间调度问题NWFSP 、 置换流水车间调度问题PFSP、 混合流水车间调度问题HFSP 、零空闲流水车间调度问题NIFSP、分布式置换流水车间调度问题 DPFSP、阻塞流水车间调度问题BFSP

👇

5 往期回顾扫扫下方二维码

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

matlab科研助手

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值