How do I compute symbolic integrals

4 views (last 30 days)
This is my code,I want to compute symbolic integrals,but the F1 I got is full of NAN.Why?and what should I do?
format long;
t=1:10000:8460000;
k=0.07;b=13.8'; ,
c=3e8;
v=0.062.*c;
eNi=3.9e10;
eCo=6.8e9;
tNi=8.8*86400;
tCo=111.3*86400;
M=1.9891e30;
Mej=2.1.*M;
kr=0.133;
A=(3.*kr.*Mej)/(4.*pi.*v^2);
M_Ni=0.1.*M;
tm=sqrt((2.*k.*Mej)/b.*v.*c);
P=@(x)eNi.* M_Ni.*exp(-x./tNi) + eCo.* M_Ni.*((exp(-x./tCo)-exp(-x./tNi))./(1-tNi/tCo));
f=@(x)exp(x.^2./tm^2).*x./tm.*P(x);
syms a
F=int(f,0,a);
F1=double(subs(F,a,t));

Accepted Answer

madhan ravi
madhan ravi on 7 May 2019
Wanted=zeros(size(t));
for k=1:numel(t)
Wanted(k)=integral(f,0,t(k));
end

More Answers (0)

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!