06-09-2016 07:05 AM
Hi all,
in the description in this link http://zone.ni.com/reference/en-XX/help/370051Y-01/cvi/libref/cvierf/
it is öentioned that the erf function Erf (double x, double *erf) has 2 inputs.the second input should be an array of double but what exactly represents this inpt to the function because as far as i know erf in matlab have only one input.
Any explications please.
Solved! Go to Solution.
06-09-2016 09:35 AM - edited 06-09-2016 09:36 AM
You are looking in the wrong place...
This function you showed is documentation for LabWindows CVI:
http://zone.ni.com/reference/en-XX/help/370051Y-01
However, you should be looking at this document:
http://zone.ni.com/reference/en-XX/help/373123B-01/lvtextmath/msfunc_erf/
In this documentation, the function is y= erf (x), as you would expect.
06-13-2016 02:14 AM - edited 06-13-2016 02:20 AM
Hi Barp,
Actually, I am working in labview communications design and not labview so the "erf" function is not defined in the C node.
I searched the erf function in this link http://www.ni.com/documentation/en/labview-comms/1.0/c-ref/analysis-lib/
and it directed me to Labwindows CVI.
as you can see the error.Any other suggestions please ?
Thanks,
06-13-2016 10:09 AM
@emnajaoua wrote:Actually, I am working in labview communications design and not labview so the "erf" function is not defined in the C node.
So why did you post this in the LabVIEW Mathscript RT forum? This discussion probably belongs over here.
You can ask the moderator to move this thread.
06-14-2016 01:52 AM
Hi,
I have already asked the question there but no luck so far.
also the "erf" function belongs to the mathscript RT module as I know so I wanted to search for a solution.
06-14-2016 10:15 AM
For this product you are using (which you did not say, but looks like LabVIEW Comms , Erf function is not supported in Mathscript or as G-code.
Now you can try this code:
a1 = 0.254829592; a2 = -0.284496736; a3 = 1.421413741; a4 = -1.453152027; a5 = 1.061405429; p = 0.3275911; s = 1; if (x < 0) s = -1; end x = abs(x); t = 1.0/(1.0 + p*x); y = 1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*exp(-x*x); y= s*y;
I converted from here: http://www.johndcook.com/blog/cpp_erf/
By the way, this code could also be easily integrated using C-node too.
Now, most likely Erf function will be available in future versions of LabVIEW Communications System Design.
06-15-2016 03:57 AM
Hi Barp,
I am sorry for not being that clear.I have tried your solution in the C node but its outputs as not correct (I don't know why by the way).So I have tried the same script in the mathscript node using this http://www.mathworks.com/matlabcentral/fileexchange/55749-error-function-stand-alone/content/erf_sta... and it seems to work.
Thanks for the solution .I missed the idea to search for a standalone function.
Best Regards,
Emna.
06-15-2016 08:49 AM
yes... I forgot that Mathscript requires ".*" if x is a vector. This is just natural as G-code...
Anyway, I am happy you have a solution until we have this function available for you.