end
Assign Dirichlet (fixed temp) or Neumann (fixed flux) conditions.
Use mldivide () for steady-state and ode45 for transient.
This example introduces vectorization. Instead of a nested for loop (which is slow in interpreted languages), we use MATLAB's ability to slice matrices. The imagesc command provides an immediate visual heatmap, allowing the engineer to instantly spot thermal gradients and verify
Water at 300 K flows at 2 m/s in a 25 mm diameter pipe. Properties: rho=997 kg/m³, μ=8.55e-4 Pa·s, k=0.613 W/mK, Pr=5.83. Find convective heat transfer coefficient.