MATLAB Answers

Why this ERROR is coming

29 views (last 30 days)
MINATI on 30 Apr 2019
Commented: Torsten on 30 Apr 2019
U7=exp(y*sqrt(P3)).*(1-erf(y/(2*sqrt(t))+ sqrt(P3*t)));
Error using erf (error function)
Input must be real and full.
Error in
U7=exp(y*sqrt(P3)).*(1-erf(y/(2*sqrt(t))+ sqrt(P3*t)));


Show 5 older comments
Walter Roberson
Walter Roberson on 30 Apr 2019
There is a way you can get around the restriction. If you use the symbolic toolbox, then the erf() function for it accepts complex inputs. To use the symbolic toolbox, at least part of the expression needs to be symbolic. For example if instead of sqrt(P3*t) you used sym(sqrt(P3*t)) then that would be enough. The result of the erf would be symbolic, so you would probably want to double() it.
Torsten on 30 Apr 2019
Or maybe another alternative:

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!