Commit 2a7e2c6b authored by Bernardo Quaresma Dias's avatar Bernardo Quaresma Dias
Browse files

Inclusão de lib-matlab 1_0

INSTMPA-1330
parent 8d0794fc
func { id = "matlab_erf", name = "MatLab: Calcular Função de Erro", group = "Matlab",
description = [[Retorna a função de erro (erf) de um valor usando o algoritmo do Matlab.]],
parameters = {
{ name = "x", type = "REAL"},
},
results = {
{ name = "Valor Calculado", type = "REAL" }
},
code = [===[ function(x)
local a1 = 0.254829592
local a2 = -0.284496736
local a3 = 1.421413741
local a4 = -1.453152027
local a5 = 1.061405429
local p = 0.3275911
local sign
if x < 0 then
sign = -1
else
sign = 1
end
x = math.abs(x)
local t = 1.0/(1.0 + p*x)
local y = 1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*math.exp(-x*x)
return sign*y
end ]===],
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment