Plot 1D heat equation solve by Fourier transform into MATLAB
15 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I'm solving for this equation below (which I believed to be a 1d heat equation) with initial condition of .
Here are just constants. I'm solving for the general case instead of a specific pde.
Apparently I the solution involves triple convolution, which ends up with a double integral. What I did was I made a function in a separate file, and then try to calculate the integral using integral2 through a loop and then plot the graph. What I don't understand is how do I specify MATLAB to integrate with respect to w and then z? Here is my code so far, and it seems to get caught in an infinite loop? The function I'm integrate is called "Integrals_18June". The solution Im trying to plot is below
sigma = 1;
mu = -1;
x1 = 1; % counter
t1 = 1; % counter
[X,T]=meshgrid(-15:0.5:15,0.1:0.2:1);
U = [];
for t = transpose(T(:,1))
for x = X(1,:)
% Incorporate coefficients
integ = integral2(@(w,z) Integrals_18June(z,w,x,t,sigma),-Inf,Inf,-Inf,Inf);
U(t1,x1)=integ*exp(mu*t)/(2*pi);
x1 = x1 +1;
end
t1 = t1+1;
x1 = 1;
end
surf(X,T,U);
xlabel("X");
ylabel("T");
zlabel("U");
0 commentaires
Réponses (1)
Shraddha Jain
le 21 Juin 2021
Hi Vicky,
Set the Integration method to 'iterated' for the 'Method' name-value pair in the input arguments of the function integral2.
0 commentaires
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!