Guest User

Untitled

a guest
Jul 17th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.48 KB | None | 0 0
  1. $ octave --no-gui heatEquation2.m
  2. Nx = 10
  3. Nt = 5
  4. dx = 0.10000
  5. dt = 0.0050000
  6. c = 1
  7. xmin = 0
  8. xmax = 1
  9. tmin = 0
  10. tmax = 1
  11. r = 0.50000
  12. rr = 2.2204e-16
  13. Vectors x
  14. ans =
  15.  
  16. 0.00000
  17. 0.10000
  18. 0.20000
  19. 0.30000
  20. 0.40000
  21. 0.50000
  22. 0.60000
  23. 0.70000
  24. 0.80000
  25. 0.90000
  26. 1.00000
  27.  
  28. Vector t
  29. ans =
  30.  
  31. 0.000000
  32. 0.005000
  33. 0.010000
  34. 0.015000
  35. 0.020000
  36. 0.025000
  37.  
  38. Result traspose(u)
  39. ans =
  40.  
  41. Columns 1 through 8:
  42.  
  43. 0.00000 0.30902 0.58779 0.80902 0.95106 1.00000 0.95106 0.80902
  44. 0.00000 0.29389 0.55902 0.76942 0.90451 0.95106 0.90451 0.76942
  45. 0.00000 0.27951 0.53166 0.73176 0.86024 0.90451 0.86024 0.73176
  46. 0.00000 0.26583 0.50564 0.69595 0.81814 0.86024 0.81814 0.69595
  47. 0.00000 0.25282 0.48089 0.66189 0.77809 0.81814 0.77809 0.66189
  48. 0.00000 0.24044 0.45735 0.62949 0.74001 0.77809 0.74001 0.62949
  49.  
  50. Columns 9 through 11:
  51.  
  52. 0.58779 0.30902 0.00000
  53. 0.55902 0.29389 0.00000
  54. 0.53166 0.27951 0.00000
  55. 0.50564 0.26583 0.00000
  56. 0.48089 0.25282 0.00000
  57. 0.45735 0.24044 0.00000
  58.  
  59. Result u - Result of PDE explicit method.
  60. u =
  61.  
  62. 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000
  63. 0.30902 0.29389 0.27951 0.26583 0.25282 0.24044
  64. 0.58779 0.55902 0.53166 0.50564 0.48089 0.45735
  65. 0.80902 0.76942 0.73176 0.69595 0.66189 0.62949
  66. 0.95106 0.90451 0.86024 0.81814 0.77809 0.74001
  67. 1.00000 0.95106 0.90451 0.86024 0.81814 0.77809
  68. 0.95106 0.90451 0.86024 0.81814 0.77809 0.74001
  69. 0.80902 0.76942 0.73176 0.69595 0.66189 0.62949
  70. 0.58779 0.55902 0.53166 0.50564 0.48089 0.45735
  71. 0.30902 0.29389 0.27951 0.26583 0.25282 0.24044
  72. 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000
  73.  
  74. Result uu - Result of PDE anlytical solution u(x, t) = exp(-pi^2 * t) * sin(pi * x) method.
  75. uu =
  76.  
  77. 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000
  78. 0.30902 0.29414 0.27997 0.26649 0.25366 0.24145
  79. 0.58779 0.55948 0.53254 0.50690 0.48249 0.45926
  80. 0.80902 0.77006 0.73298 0.69769 0.66410 0.63212
  81. 0.95106 0.90526 0.86167 0.82018 0.78069 0.74310
  82. 1.00000 0.95185 0.90602 0.86239 0.82087 0.78134
  83. 0.95106 0.90526 0.86167 0.82018 0.78069 0.74310
  84. 0.80902 0.77006 0.73298 0.69769 0.66410 0.63212
  85. 0.58779 0.55948 0.53254 0.50690 0.48249 0.45926
  86. 0.30902 0.29414 0.27997 0.26649 0.25366 0.24145
  87. 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000
  88.  
  89. Error between analytical solution and computed PDE explicit metod solution
  90. ans =
  91.  
  92. 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
  93. 0.0000000 0.0002451 0.0004665 0.0006657 0.0008446 0.0010045
  94. 0.0000000 0.0004663 0.0008873 0.0012663 0.0016065 0.0019106
  95. 0.0000000 0.0006418 0.0012213 0.0017430 0.0022111 0.0026297
  96. 0.0000000 0.0007545 0.0014357 0.0020490 0.0025993 0.0030914
  97. 0.0000000 0.0007933 0.0015096 0.0021544 0.0027331 0.0032505
  98. 0.0000000 0.0007545 0.0014357 0.0020490 0.0025993 0.0030914
  99. 0.0000000 0.0006418 0.0012213 0.0017430 0.0022111 0.0026297
  100. 0.0000000 0.0004663 0.0008873 0.0012663 0.0016065 0.0019106
  101. 0.0000000 0.0002451 0.0004665 0.0006657 0.0008446 0.0010045
  102. 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
  103.  
  104. Maximum absolute error
  105. ans = 0.0032505
  106. Plot results
Add Comment
Please, Sign In to add comment