%% sin-cos wave data write in coe file clear all ; clc ;
width = 12;%与幅值有关 N = 1024 ; % depth 数据个数 y = zeros(N , 1) ; for i = 1:1:N x = i ; y(i,1) = ceil( 240*cos(x*2*pi/400) ) + 240 ;%显示屏800*480 end plot(y); hold on; fid = fopen('cos_1024.coe','wt'); %- standard format fprintf( fid, 'MEMORY_INITIALIZATION_RADIX = 10;\n'); fprintf( fid, 'MEMORY_INITIALIZATION_VECTOR =\n'); %- write data in coe file for i = 1:1:N fprintf(fid,'%d,\n',y(i,1)); end fclose(fid);