MATLAB: Do i get “Too many output arguments” when i try to multiply the function

matlab functionoutput error

My function is
function integralCO02(t)
(2/sqrt(pi))*exp(-t^2)
end
and when I try
2*integralCO02(5)
the error message 'Too many output arguments.' comes up.
The same happens for
anyconstante = integralCO02(5)

Best Answer

You did not create an output when you declared your function.
Try this slightly modified version of your function:
function result = integralCO02(t)
result = (2/sqrt(pi))*exp(-t^2);
end
The call to it:
anyconstante = integralCO02(5)
now produces:
anyconstante =
1.567086653101734e-11