tailieunhanh - Design and Optimization of Thermal Systems Episode 3 Part 8

Tham khảo tài liệu 'design and optimization of thermal systems episode 3 part 8', kỹ thuật - công nghệ, cơ khí - chế tạo máy phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Appendix A 647 p2 1 -10 35 -50 24 p3 1 -7 17 -17 6 y1 polyval p1 x y2 polyval p2 x y3 polyval p3 x plot x y1 g x y2 b x y3 m hold on y zeros size x plot x y r Ordinary Differential Equations Given ODE dh dt 6x10-4 - 3x10-4 x h0-5 Enter given ODE dhdt inline 6 10A -4 - 3 10A -4 hA t h Choose step size and total time dt 10 tn 200 dt h0 0 t 0 dt tn n length t h h0 ones n 1 Euler s Method for j 2 n h j h j-1 dt dhdt t j-1 h j-1 end plot t h -b Heun s Method t 0 dt tn for j 2 n h1 h j-1 dt dhdt t j-1 h j-1 h j h j-1 dt 2 dhdt t j h1 dhdt t j-1 h j-1 end hold on plot t h -g Using ode23 t h ode23 dhdt 2000 0 Higher order ODE Second order ODE d2x dt2 - dx dt 648 Design and Optimization of Thermal Systems Replaced by two first order ODEs dx dt y dy dt - y Enter two first-order equations dxdt inline y t x y dydt inline y t x y Give step size end point and starting conditions dt tn 40 dt x0 0 y0 0 t 0 dt tn n length t x x0 ones n 1 y y0 ones n 1 Euler s Method for j 2 n x j x j-1 dt dxdt t j-1 x j-1 y j-1 y j y j-1 dt dydt t j-1 x j-1 y j-1 end plot t x -b t y -g Using ode45 Define function function dydt rhs t y dydt y 2 y 2 Solve ODE given by function rhs y0 0 0 t y ode45 rhs 20 y0 Then y 1 gives x and y 2 gives y C GAUSSIAN ELIMINATION FOR A TRIDIAGONAL SYSTEM C C A I B I AND C I ARE THE THREE ELEMENTS IN EACH ROW OF C THE GIVEN SYSTEM OF EQUATIONS F I REPRESENTS THE CONSTANTS C ON THE RIGHT-HAND SIDE OF THE EQUATIONS T I ARE THE TEMPERATURE C DIFFERENCES TO BE COMPUTED G IS A PARAMETER DEFINED IN THE GIVEN C PROBLEM N IS THE NUMBER OF EQUATIONS AND TP REPRESENTS THE C PHYSICAL TEMPERATURE WHERE TP T 20. THE SYSTEM OF EQUATIONS C TO BE SOLVED IS THE ONE GIVEN IN EXAMPLE . Appendix A 649 C PARAMETER IN 30 DIMENSION A IN B IN C IN T IN F IN C C SPECIFY INITIAL PARAMETERS C CALL INPUT A B C F N CALL TDMA A B C F N T C C COMPUTE ACTUAL TEMPERATURES FROM THE TEMPERATURE DIFFERENCES T I C WRITE 6 7 7 FORMAT 2X .

TỪ KHÓA LIÊN QUAN