diff --git a/Mex/a752.cpp b/Mex/a752.cpp new file mode 100644 index 0000000..6909440 --- /dev/null +++ b/Mex/a752.cpp @@ -0,0 +1,59 @@ +#include "mex.h" +#include "matrix.h" +#include "stdlib.h" + + + +void mexFunction(int nlhs, mxArray *plhs[], // Output + int nrhs, const mxArray *prhs[]) // Input +{ + /* + char *func_Name; + func_Name = mxArrayToString(prhs[0]); + double* tout = mxGetPr(prhs[4]); + double* xout = mxGetPr(prhs[5]);*/ + + double t0 = *mxGetPr(prhs[0]); + double tfinal= *mxGetPr(prhs[1]); + double x0 = *mxGetPr(prhs[2]); + + double theta_umg = 20, //temp of room + theta = x0, //start temp + h = 1, //incremtens size + t_start = t0, //start time + t_end = tfinal, //end time + t=t_start, + theta_dot = 0; + + int len = (t_end-t_start)/h+1; + double* t_out = (double *)mxCalloc(len, sizeof(double)); //array cont. time stamps + double* theta_out = (double *)mxCalloc(len, sizeof(double)); //array cont. temp + + + t_out[0]=t_start; + theta_out[0]=theta; + + for(int i = 1; t