⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 difm.m

📁 此程序给出了不同情况的雷达距离测量仿真平台
💻 M
字号:
% DIFM Output Gray and Binary Codes
% ----------------------------------

clear;clf;clc;

% Input DIFM parameters and input frequency

td=input('Enter time delay in sec:  ');
fo=input('Enter frequency in Hz:  ');
m=input('Enter number of correlators:  ');
T=1e-4;

% Calculate measured frequency of analog IFM

t=0:T/1000:T;
vin=exp(j*2*pi*fo*t);
vd=exp(j*2*pi*fo*(t-td));
vo=vin.*conj(vd);
vc=mean(real(vo));
vs=mean(imag(vo));
f=atan(vs/vc)/(2*pi*td);
if vs<=0 & vc>=0;
   f=(2*pi+atan(vs/vc))/(2*pi*td);end;
if vs<=0 & vc<=0;
   f=(pi+atan(vs/vc))/(2*pi*td);end;
if vs>=0 & vc<=0;
   f=(pi+atan(vs/vc))/(2*pi*td);end;

fprintf('\nfo= %-6.4e \n',f);

% Find Gray code

if vs<=0;x(1)=1;
else x(1)=0;end;

for i=1:m-1;
   td1=td*2^(i-1);
   vd1=exp(j*2*pi*fo*(t-td1));
   vo1=vin.*conj(vd1);
   vc1=mean(real(vo1));
   
   if vc1<=0;x(i+1)=1;
   else; x(i+1)=0;end;
end;

graycode=x;
graycode

% Convert Gray code to Binary code

y(1)=x(1);

for i=1:length(x)-1;
   
   if y(i)+x(i+1)==1;y(i+1)=1;
   else y(i+1)=0;end;
end;

binary=y;
binary

% Find Decimal output

z=fliplr(y);
z=find(z);
zz=z-1;
zzz=2.^zz;

decimal=sum(zzz);
fr=decimal/(td*2^m)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -