Plot 1D heat equation solve by Fourier transform into MATLAB
9 ビュー (過去 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
[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 件のコメント
回答 (1 件)
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.
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!