Skip to content

Instantly share code, notes, and snippets.

@iamharshit
Created November 2, 2017 19:37
Show Gist options
  • Save iamharshit/6776f78841ae7d9b055e512576f519ac to your computer and use it in GitHub Desktop.
Save iamharshit/6776f78841ae7d9b055e512576f519ac to your computer and use it in GitHub Desktop.
generates a csv file containing data(x,f(x)) which is used for training neural nets
function generate_data()
if exist('data_harshit.csv', 'file') == 2
delete data_harshit.csv;
end
x=[-1000:20:1000];
y=f(x);
ans=vertcat(x,y)';
csvwrite('data_harshit.csv',['x','y']);
dlmwrite('data_harshit.csv',ans,'delimiter',',','-append');
function a=f(x)
a=2*x;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment