Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpa
libs
pucrio-tecgraf
Commits
2a7e2c6b
Commit
2a7e2c6b
authored
Sep 09, 2021
by
Bernardo Quaresma Dias
Browse files
Inclusão de lib-matlab 1_0
INSTMPA-1330
parent
8d0794fc
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib-matlab-1_0.mpam
0 → 100644
View file @
2a7e2c6b
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 ]===],
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment