In the previous post, https://autarkaw.wordpress.com/2010/08/24/finding-the-inverse-error-function/, we set up the nonlinear equation to find the inverse of error function. Using the int and solve MATLAB commands, we write our own program to find the inverse error function.

It is better to **download** (right click and save target) the program as single quotes in the pasted version do not translate properly when pasted into a mfile editor of MATLAB or you can read the **html version **for clarity and sample output.

%% 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

% http://numericalmethods.eng.usf.edu/blog/inverseerror.pdf

% and we are solving Exercise 1 of the pdf file.

%% 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 https://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(‘ ‘)

%% INPUTS

% Value of error function

erfx=0.5;

%% DISPLAYING INPUTS

disp(‘INPUTS’)

fprintf(‘ The value of error function= %g’,erfx)

disp(‘ ‘)

disp(‘ ‘)

%% 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(‘ ‘)

___________________________________________________

This post is brought to you by

Holistic Numerical Methods: Numerical Methods for the STEM undergraduate at http://numericalmethods.eng.usf.edu,

the textbook on Numerical Methods with Applications available from the lulu storefront,

the textbook on Introduction to Programming Concepts Using MATLAB, and

the YouTube video lectures available at http://numericalmethods.eng.usf.edu/videos

Subscribe to the blog via a reader or email to stay updated with this blog. Let the information follow you.

## One thought on “Using int and solve to find inverse error function in MATLAB”