add_noise.m
资源名称:TOA_uwb.rar [点击查看]
上传用户:doryuen
上传日期:2013-10-30
资源大小:23k
文件大小:1k
源码类别:
通讯/手机编程
开发平台:
Matlab
- function out=add_noise(v,rate,down,up)
- % add impulsive NLOS error to normal error
- % v: normal location error
- % rate: the ratio of impulsive NLOS error to the lenght of normal error
- % up: up bound of impulsive NLOS error
- % down: down bound of impulsive NLOS error
- N=round(length(v)*rate);
- nlos=down+(up-down)*rand(1,N);
- K=length(v);
- out(1:K)=0;
- for n=1:N
- index=randint(1,1,K-1)+1;
- out(index)=v(index)+nlos(n);
- end
- out=out+v;