How to set diffrent initial conditions as a vector.
3 次查看(过去 30 天)
显示 更早的评论
I want define the initial condtions as vector that contains diffrent temperature value for each node.
global rho Cp k t Tair h1 h2
rho = 1;
Cp = 4.187;
k = 0.59803;
L = 1;
x = linspace(0,L,5);
endt = 0.5*3600;
t = linspace(0,endt,1+endt/60);
m = 0;
Tair = 0;
h1 =10;
h2 = 30;
sol = pdepe(m,@heatpde,@heatic,@heatbc,x,t);
figure
plot(t/60,sol,'LineWidth',1.5)
legend('Node 1','Node 2','Node 3','Node 4','Node 5')
function [c,f,s] = heatpde(x,t,u,dudx)
global rho Cp k
c = rho*Cp*1000;
f = k*dudx;
s = 0;
end
function u0 = heatic(x)
u0 = 20;
end
function [pl,ql,pr,qr] = heatbc(xl,ul,xr,ur,t)
global Tair h1 h2
pl = -(h1)*(ul-Tair);
ql = 1;
pr = (h2)*(ur-Tair);
qr = 1;
end
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!