# how to convert answer to one single number

6 views (last 30 days)
Faezeh Manesh on 20 Sep 2019
Commented: madhan ravi on 20 Sep 2019
Hello Everybody,
I am trying to integrate a function as follows:\
clc
clear all
syms x
f = 2.048*exp(-((x-5.056)/0.2349)^2) + 1.089*exp(-((x-4.887)/0.4006)^2) + 0.4116*exp(-((x-9.103)/5.731)^2);
b=int(f,0,8.475167785)
I need a value for this integral but MATLAb gives me the following expression wich is useless for me:
b =
(5897199*pi^(1/2)*(erf(9103/5731) - erf(22089882261915571/201641636441096192)))/5000000 + (2181267*pi^(1/2)*(erf(24435/2003) + erf(631237152323000705/70474297293930496)))/10000000 + (18792*pi^(1/2)*(erf(50560/2349) + erf(601506357907937665/41324045018333184)))/78125
>> Do you know how I can convert this expression to a single value easily?

madhan ravi on 20 Sep 2019
f = @(x) 2.048*exp(-((x-5.056)/0.2349).^2) +...
1.089*exp(-((x-4.887)/0.4006).^2) +...
0.4116*exp(-((x-9.103)/5.731).^2);
b = integral(f,0,8.475167785)
madhan ravi on 20 Sep 2019
Or in your case simply use:
vpa(b)