compare_with_matlab.m
来自「mimo2x2天线选择系统的全系统matlab程序,先前的是dsp程序.」· M 代码 · 共 26 行
M
26 行
% Run this program and follow the instructions to compare DSP and matlab
% implementations of the same function.
Input=(0:15)-(rand*15);
write_float32_hex('Input.dat',Input);
Input_short=0:3;
write_int16_hex('Input_short.dat',Input_short);
Output_Matlab=FunctionToBeTested(Input);
disp('1) Load the program.')
disp('2) Load data in DSP (File->Data->Load->"Input.dat"->Open->Adress=Input->OK) or use load.gel');
disp('3) Run DSP program.');
disp('4) Save data from DSP (File->Data->Save->"Output.dat"->Adress=Output,Length=16->OK) or use save.gel');
disp('5) Press any key in this matlab window');
pause
Output_DSP=read_float32_hex('Output.dat')
% Compare e.g. graphically
hold off
plot(Output_Matlab,'b')
hold on
plot(Output_DSP+0.1,'g')
legend('Matlab result','DSP result');
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?