MATLAB Answers


Need help initializing a PDE boundary condition

Asked by Kelly
on 5 Feb 2013

I'm working with the heat equation (PDE), and I'm unsure how to set up my boundary conditions in a Matlab script. I need to initialize the boundary condition U(x=0) = t(6-t)

equation %(U*x-1-2U*x+U*x+1)/(x^2)

dt = 0.01; % time step dx = 0.01; % distance step K=0.002; % the constant value

%initialize vectors for distances 0 to 5 and time 0 to 20 time = 0:dt:20; t = length(time); x = 0:dx:5; row = length(t); col = length(x);

% Initialize temperature array U = zeros(row,col);

 initialize the surface boundary condition U(x=0) = t(6-t)


Log in to comment.

0 Answers

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Win prizes and improve your MATLAB skills

Play today