📄 sine.m
字号:
% Creat a data file of the sinewave, which DSP chip can load .%
clear all;
Fs=8000; %Sampling Frequecy of AD535 chip=8KHz%
f1=100; %Frequency of Sine Wave"
y=10*sin(2*pi*f1*[0: 1023]/Fs); % Number of Sampling point=160, and create sine wave%
plot(y);
grid on;
reply=input('Please input category of data: '); % input category of data%
fid=fopen('sine1.dat', 'w'); %creat a data file in the given folder%
fprintf(fid, '1651 %d 0 0 0 \n', reply); % output the head file of .dat file %
switch reply % output data into the .dat file according to the category of data%
case 1
fprintf(fid, '0x%x\n', y); % output 32bit hexadecimal data %
case 2
fprintf(fid, '%d\n', round(y)); % output 32bit float data %
case 3
fprintf(fid, '%12.1f\n', round(y)); % output 40bit long inter data %
case 4
fprintf(fid, '%f\n', y); % outout 32bit integer data %
end
fclose(fid); % close the .dat file
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -