It will not give you a symbolic expression because you are not using the Symbolic Math Toolbox to integrate it. (That would likely not work anyway.) You can have it produce an anonymous function:
c=0;
Da = .4;
sigma = 0.1;
a=1;
b=1.3;
L=Inf;
Greens= @(x,zeta,t) (1/2*sqrt(pi*a*t)).*exp(b*(zeta-x)/(2*a) + (c-b^2/(4*a))*t).*(exp(-(x-zeta).^2/(4*a*t))+exp(-(x+zeta).^2./(4*a*t)));
fun = @(x,t,zeta,tau) Da.*sigma.*exp(x.*t).*Greens(x,zeta,t-tau);
C = @(x,t) integral2(@(zeta,tau)fun(x,t,zeta,tau),0,t,0,L);
X = linspace(0,0.05,10);
T = linspace(0,0.08,20);
for k1 = 1:numel(X)
for k2 = 1:numel(T)
Z(k1,k2) = C(X(k1),T(k2));
end
end
figure
surf(T, X, Z)
There were several errors in your code that I corrected. This runs, although it does not give any useful output (all are NaN). I leave you to solve that problem, and make any corrections that may be necessary, since I have no idea what you are doing or what the correct values for âxâ and âtâ are.
Best Answer