I need to use the following function in matlab code:
#include "mex.h"#include <math.h>#include <stdio.h>float xFit_1931( float wave ){float t1 = (wave-442.0f)*((wave<442.0f)?0.0624f:0.0374f);float t2 = (wave-599.8f)*((wave<599.8f)?0.0264f:0.0323f);float t3 = (wave-501.1f)*((wave<501.1f)?0.0490f:0.0382f);return 0.362f*expf(-0.5f*t1*t1) + 1.056f*expf(-0.5f*t2*t2)- 0.065f*expf(-0.5f*t3*t3);}float yFit_1931( float wave ){float t1 = (wave-568.8f)*((wave<568.8f)?0.0213f:0.0247f);float t2 = (wave-530.9f)*((wave<530.9f)?0.0613f:0.0322f);return 0.821f*exp(-0.5f*t1*t1) + 0.286f*expf(-0.5f*t2*t2);}float zFit_1931( float wave ){float t1 = (wave-437.0f)*((wave<437.0f)?0.0845f:0.0278f);float t2 = (wave-459.0f)*((wave<459.0f)?0.0385f:0.0725f);return 1.217f*exp(-0.5f*t1*t1) + 0.681f*expf(-0.5f*t2*t2);}
I tried to build a mex file for this function but I get this error:
I know that expf is an exponential function but I don't know how to define it.
Thanks for your help.
Best Answer