Plot 1D heat equation solve by Fourier transform into MATLAB

조회 수: 17(최근 30일)
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
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);
x1 = x1 +1;
t1 = t1+1;
x1 = 1;


Shraddha Jain
Shraddha Jain 2021년 6월 21일
Hi Vicky,
Set the Integration method to 'iterated' for the 'Method' name-value pair in the input arguments of the function integral2.
Once this is specified, integral2 calls integral to perform an iterated integral. The outer integral is evaluated over xminxxmax. The inner integral is evaluated over ymin(x)yymax(x). The integration limits can be infinite.
Refer to the documentation of integral2 for more information. Hope this helps!

Community Treasure Hunt

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

Start Hunting!

Translated by