#include "mex.h" #include "matrix.h" #include "stdlib.h" #include "math.h" void mexFunction(int nlhs, mxArray *plhs[], // Output variables int nrhs, const mxArray *prhs[]) // Input variables { int variables = *mxGetPr(prhs[0]); variables++; double inc = *mxGetPr(prhs[1]); double* x = (double *)mxCalloc(variables, sizeof(double)); double* y = (double *)mxCalloc(variables, sizeof(double)); for(int i=0;i= x[i] && xx[j] <= x[i + 1]) { // Interpolationsformel yy[j] = ((y[i + 1] - y[i]) / (x[i + 1] - x[i])) * (xx[j] - x[i]) + y[i]; } else if (xx[j] > x[i + 1]) { savepoint = j; break; } } } //Code von Marvin Lehmann ende nlhs = 2; plhs[0] = mxCreateDoubleMatrix(1, len, mxREAL); memcpy(mxGetPr(plhs[0]), xx, len*sizeof(double)); plhs[1] = mxCreateDoubleMatrix(1, len, mxREAL); memcpy(mxGetPr(plhs[1]), yy, len*sizeof(double)); return; }