FINDING INVERSE ERROR FUNCTION
In a previous blog at autarkaw.wordpress.com (August 24, 2010), we set up a nonlinear equation to find the inverse error function. In this blog, we will solve this equation. The problem is given at and we are solving Exercise 1 of the pdf file.
Contents
TOPIC
Finding inverse error function
SUMMARY
% Language : Matlab 2010a; % Authors : Autar Kaw; % Mfile available at % http://numericalmethods.eng.usf.edu/blog/inverse_erf_matlab.m; % Last Revised : August 27, 2010 % Abstract: This program shows you how to find the inverse error function clc clear all
INTRODUCTION
disp('ABSTRACT') disp(' This program shows you how to') disp(' find the inverse error function') disp(' ') disp('AUTHOR') disp(' Autar K Kaw of http://autarkaw.wordpress.com') disp(' ') disp('MFILE SOURCE') disp(' http://numericalmethods.eng.usf.edu/blog/inverse_erf_matlab.m') disp(' ') disp('PROBLEM STATEMENT') disp(' http://numericalmethods.eng.usf.edu/blog/inverseerror.pdf') disp(' Exercise 1') disp(' ') disp('LAST REVISED') disp(' August 27, 2010') disp(' ')
ABSTRACT This program shows you how to find the inverse error function AUTHOR Autar K Kaw of http://autarkaw.wordpress.com MFILE SOURCE http://numericalmethods.eng.usf.edu/blog/inverse_erf_matlab.m PROBLEM STATEMENT http://numericalmethods.eng.usf.edu/blog/inverseerror.pdf Exercise 1 LAST REVISED August 27, 2010
INPUTS
Value of error function
erfx=0.5;
DISPLAYING INPUTS
disp('INPUTS') fprintf(' The value of error function= %g',erfx) disp(' ') disp(' ')
INPUTS The value of error function= 0.5
CODE
syms t x inverse_erf=solve(int(2/sqrt(pi)*exp(-t^2),t,0,x)-erfx); inverse_erf=double(inverse_erf);
DISPLAYING OUTPUTS
disp('OUTPUTS') fprintf(' Value of inverse error function from mfile is= %g',inverse_erf) fprintf('\n Value of inverse error function using erfinv is= %g',erfinv(erfx)) disp(' ')
OUTPUTS Value of inverse error function from mfile is= 0.476936 Value of inverse error function using erfinv is= 0.476936