Advertisement
Guest User

gen_sine

a guest
Aug 8th, 2016
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Octave 0.28 KB | None | 0 0
  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);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement