matlab学习之路
for循环
for i = 1:10
end
加载文件
si = load("E:\xilinx_fpga\lfm_test\matlab\LFM_r_out.dat");
画图的操作
横坐标的量化(pw是时基)
t = linspace(-pw/2,pw/2,3000);
打开文件
hi_coefile = fopen('hi_B50M_10us.coe','w');
写文件
fprintf(hi_coefile,'radix=10;\n');
fprintf(hi_coefile,'%d;\n',hiw(length(hiw)));
关闭文件(操作完一定要关闭才能刷新):
fclose all;
序列长度 用于for循环 或者补0操作等
for coen = 1:length(hqw)-1
end
抽取(其实隔点采样):
hiw = hiw(1:chouqu:end);
雷达信号经典生成
fclk = 300e6;% FPGA时钟
Ts = 1/fclk;
pw = 10e-6;
B = 50e6;
u = B/pw;%调频斜率
t = linspace(-pw/2,pw/2,3000);
h_base = exp(-j*pi*u*t.^2);
hi = real(h_base);
hq = imag(h_base);
stft时频做法
clc;
clear;
close all;
st_sin = load("E:\xilinx_fpga\lfm_test\matlab\LFM_r_out.dat");
st_cos = load("E:\xilinx_fpga\lfm_test\matlab\LFM_i_out.dat");
st = (st_cos+1i*st_sin)';
fs = 125e6;
window = 80;
[s,f,t] = stft(st(1,:),fs,'Window',hamming(window),'OverlapLength',window-1,'FFTLength',2048);
figure;
imagesc(t*1e6,f*1e-6,abs(s));
xlabel("t/us");ylabel("f/MHz");
set(gca,'YDir','normal');
set(gca,'Fontsize',12);set(gca,'FontWeight','bold');
读取文件
fid_re1 = fopen('LFM_r_out.dat','r');
x_re1 = fscanf(fid_re1,'%d',[2400,1]);
生成0序列 用于补0 或者生成模板
a=zeros(1,ChNum);
取序列的最尾数
dataout1(1:4:end)
向下取整函数
dataout1(1:4:end)
fft
fftshift(fft(x_im)
#如果要做2的整数倍 自己加个逗号后面写点数