SHARE
TWEET

gen_sine

a guest Aug 8th, 2016 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. % Generating an raw unsigned char file with a sinus.
  2. % open file sample.raw for writing, generate values
  3. % write file and close (incedentaly plot)
  4. myfile = fopen ("sine.raw", "w");
  5. x = linspace(0, 2*pi, 64);
  6. y = 128*sin(x)+128;
  7. fwrite(myfile,y,"uint8");
  8. fclose(myfile);
  9. plot(x, y);
RAW Paste Data
Top