Skip to content

Instantly share code, notes, and snippets.

View dbourkey's full-sized avatar

David J. Bourke dbourkey

  • London
View GitHub Profile
@dbourkey
dbourkey / J_gaussian.cpp
Created April 11, 2016 22:27
Creates a 20x20 matrix of randomly generated numbers using a gaussian distribution. Takes mean and standard deviation as input parameters.
#include "mex.h"
#include <random>
void mexFunction(int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[])
{
plhs[0] = mxCreateDoubleMatrix(20, 20, mxREAL);
double *J = mxGetPr(plhs[0]);
double mean = *mxGetPr(prhs[0]);
double dev = *mxGetPr(prhs[1]);