I'm using a C function in matlab simulink to get the output of non linear equation of the form y = x + e^x. Though I can't get through this after a big headache and a lot of effort. You are my last hope my friends, so thank you in advance.

Here is the code:

All the parameters are defined externally as double.Code:void Sigma(const real_T *Tc,const real_T *Irradiance,const real_T *Vpv,const real_T *Ipv, real_T *I0) { real_T Irs, Is, J, Tcc; (Ipv[0] < 0) ? (J=0) : (J = Ipv[0]); Tcc = (Tc[0]) + 273.15; /* Celsius to Kelvin Trasformation*/ Irs = (IscRef) / (exp((q) * ((VocRef) + (beta) *((Tcc)-(Tref))) / ((Ns) * (K) * (eta) * (Tcc))) -1); Is = (Irs) * (pow(Tcc/Tref, 3)) * exp( (q) * (Eg) * (1/(Tref) - 1/(Tcc))/((K) * (eta))); I0[0] = (Np) * (((alpha) * ((Tcc) - (Tref)) + (IscRef)) * (Irradiance[0])/(Irradiance_ref)) - ((Is) * (exp((q) * ((Vpv[0])/(Ns) + (J) * (Rs)/(Np)) / ((K) * (Tcc) * (eta))) -1) + ((Np)/(Ns) * (Vpv[0]) + (J) * (Rs)) / (Rsh)); }

Matlab has a C compiler installed and co-working with it in real time

Here is the builder error:

Code:Error PV_module_wrapper.c: 71 syntax error; found `{' expecting `;' Error PV_module_wrapper.c: 71 skipping `{' Error PV_module_wrapper.c: 75 operands of - have illegal types `double' and `pointer to const double' Error PV_module_wrapper.c: 75 operands of * have illegal types `pointer to const double' and `int' Error PV_module_wrapper.c: 75 operands of * have illegal types `pointer to const double' and `pointer to const double' Error PV_module_wrapper.c: 75 operands of * have illegal types `pointer to const double' and `pointer to const double' Error PV_module_wrapper.c: 75 operands of * have illegal types `int' and `pointer to const double' Error PV_module_wrapper.c: 75 operands of / have illegal types `pointer to const double' and `double' Error PV_module_wrapper.c: 76 operands of / have illegal types `double' and `pointer to const double' Error PV_module_wrapper.c: 76 operands of * have illegal types `pointer to const double' and `pointer to const double' Error PV_module_wrapper.c: 76 operands of / have illegal types `int' and `pointer to const double' Error PV_module_wrapper.c: 76 operands of * have illegal types `pointer to const double' and `pointer to const double' Error PV_module_wrapper.c: 77 undeclared identifier `I0' Error PV_module_wrapper.c: 77 type error: pointer expected Error PV_module_wrapper.c: 77 operands of - have illegal types `double' and `pointer to const double' Error PV_module_wrapper.c: 77 operands of * have illegal types `pointer to const double' and `int' Error PV_module_wrapper.c: 77 operands of * have illegal types `pointer to const double' and `double' Error PV_module_wrapper.c: 77 operands of / have illegal types `int' and `pointer to const double' Error PV_module_wrapper.c: 77 operands of * have illegal types `pointer to const double' and `int' Error PV_module_wrapper.c: 78 operands of / have illegal types `double' and `pointer to const double' Error PV_module_wrapper.c: 78 too many errors C:\PROGRA~1\MATLAB\R2009B\BIN\MEX.PL: Error: Compile of 'PV_module_wrapper.c' failed.