SOLVING PDE using MATLAB

1 view (last 30 days)
Mr.DDWW
Mr.DDWW on 30 Mar 2022
Commented: Torsten on 30 Mar 2022
clc;clear all;close all;
L = 1;
x = linspace(0,L,75);
t = linspace(0,1,75);
m = 0;
sol = pdepe(m,@heatpde,@heatic,@heatbc,x,t);
sol1=sol;
figure(1)
surf(x,t,sol1);
xlabel('y/b');
zlabel('(T-T_0)/(T_1-T_0)');
title('Temperature Distribution in Finite Slab, Nu=1'); grid on;
function [c,f,s] = heatpde(x,t,u,dudx)
c = 1;
f = dudx;
s = 0;
end
function u0 = heatic(x)
u0 = 1;
end
function [pl,ql,pr,qr] = heatbc(xl,ul,xr,ur,t)
Nu = 1.0;
pl = 0;
ql = 1;
pr = Nu*ur;
qr = 1;
end
Can someone please verify if the plot as well as the method is correct ? I am trying to solve the pde in images using matlab

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!