10.07.2015 Views

Numerical Methods Library for OCTAVE

Numerical Methods Library for OCTAVE

Numerical Methods Library for OCTAVE

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ReturnsT grid of NT intervals.X grid of NX intervals.U solution array.[T, X, U] = PDE_HEAT_IMP(N, DX, K, DT, C, F, ALPHA, BETA) solves the heatequation D U/DT = C D2U/DX2 with the implicit method on [0,1]x[0,1]. Initialcondition is U(0,X) = F and boundary conditions are U(t,0) = ALPHA and U(t,1)= beta. C is a positive constant. N is the number of space integrationintervals and K is the number of time-integration intervals. DX is the sizeof a space integration interval and DT is the size of time-integration intervals.ParametersNX number of space integration intervals.DX size of a space integration interval.NT number of time-integration intervals.DT size of time-integration intervals.F initial condition U(0,X) = F(X).C positive constant.ReturnsT grid of NT intervals.X grid of NX intervals.U solution array.The jacobian matrix of the semidiscrete system has eigenvalues between −4c/(∆x) 2 and 0,and hence the stability region <strong>for</strong> Euler’s method requires that the time step satisfy∆t ≤ (∆x)22c(22)3.10.4 2-D solver <strong>for</strong> Wave equationWave equation :u tt = cu xx (23)[T, X, U] = PDE_WAVE_EXP(N, DX, K, DT, C, F, G, ALPHA, BETA) solves thewave equation D2U/DT2 = C D2U/DX2 with the explicit method on [0,1]x[0,1].Initial condition is U(0,X) = F, D U/DT (0,X)= G(X) and boundary conditionsare U(t,0) = ALPHA and U(t,1) = beta. C is a positive constant. N is thenumber of space integration intervals and K is the number of time-integrationintervals. DX is the size of a space integration interval and DT is thesize of time-integration intervals.ParametersNX number of space integration intervals.DX size of a space integration interval.NT number of time-integration intervals.29

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!