I have a solution to the heat equation (a function of two variables $x$ and $t$) which is in the form of an infinite series. I want to know what the solution actually looks like at specific times. My solution is:
where the coefficients are given by
and the function is known and given at the bottom. I am having problems with my Matlab code when I try to actually calculate these things however. What I have right now is:
h = .01;
xVec = 0:h:5;
for n = 1:100
h_FC_integrand = @(x,s) (x.*(10-x).*sin((pi*n.*x)/5) ./ (1+ ...
(x-5 * (1 + sin(2*pi.*s)./(s+1))).^2));
h_FC = @(s) ((2/5) * exp(((n*pi)/5)^2 * s) * ...
Cn = quadgk(h_FC,0,.01);
sinVec = sin((pi*n*xVec)/5);
solutionVec1 = solutionVec1 + (Cn * exp(-((n*pi)/5)^2 * .01) ...
The problem is in the line where I try to evaluate for . Matlab is giving me the error "Not enough input arguments." but I don't see what the problem is. The function handle h_FC is of only one variable so I don't need to specify which variable I want to integrate in and I give both the endpoints of integration. Any help would be much appreciated!
Also, this same basic idea worked quite easily when the coefficients had no time dependence (I tried essentially this exact same method for a different problem and had no issues).