📄 compare_with_matlab.m
字号:
% 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -