How do I make/solve a diffrential equation with two variables
Show older comments
Hello, I'm trying to solve this model (see sketch). This leads to a diffrential equation with three unkonws being T1,T2 and Ts. Ive gotten it to a point where I can solve by stating a fixed value for T2 and computing Ts by taking the average of T1 and T2. This is wrong because Ts is time and place dependent and T2 will evventualy heat up as well. So the next step is implementing place dependency for T in my model and.
This is where I'm stuck. I have very little experience with matlab and have no idea on how to make this work.
This is the current code I have:
clear all
close all
clc
% Solve thermal first order difrential equation rho*V*cp DT/dt = sum of
% heat fluxes and plot temprature in function of time
rho = 0.0022 ; %density in g/mm³
k=1.38 ; %thermal conductivty in mW/(mm K)
cp=0.772 ;
h=0.01; % heat transfer coeficient in mW/(mm²K)
Tinf=22; % nominal temprature of surouniding
L=16.8; %lenght of block in mm height is the direction conduction moves in
H=1.31; %height of the block in mm
W=7; %width of the block in mm
Aw=H*W; % surface trough which the conduction flows in mm²
As=W*L; % surface where convecgtion takes place in mm²
V=Aw*L; % Volume of the block
C=rho*cp*V;
Qin=0.0216; %heat input in W
nP=3; %number of periods you want to plot
P=14.4; %Period
scan=0.05; %input time
t=[0 P*nP];
sw=@(t) sawtooth(t*2*pi/P)/2+0.5<(scan/P); %make a square wave
OPT=odeset('MaxStep',1e-3);
[t,T]=ode45(@(t,T) (Qin*sw(t)-(1e-3*k*Aw*(T-Tinf)/L)-(1e-3*h*As*((T+Tinf)/2-Tinf)))/C,t,Tinf,OPT);
figure;
hold on
plot(t,sw(t)*Qin)
plot(t,T-Tinf) % in order to put everyting on the zero axis
I would love to hear feedback and suggestions.
Thanks in advance,
Robin
4 Comments
James Tursa
on 15 Nov 2018
Please post the differential equations you are trying to solve, along with any constants and initial conditions.
Robin Muylle
on 16 Nov 2018
Torsten
on 16 Nov 2018
Use "pdepe" for this task.
Best wishes
Torsten.
Robin Muylle
on 16 Nov 2018
Answers (0)
Categories
Find more on Thermal Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!