Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
![]() |
#1 |
高级会员
注册日期: 2019-11-21
帖子: 3,006
声望力: 66 ![]() |
![]() having some trouble with this code. My professor asked us to create a function "feuler.m" in matlab to solve the initial-value problem given by the differential equation u′(t) = (2+2t)e^t and the initial condition u(0) = 0 over the interval [0, 5] that uses (forward) Euler’s method to graph the exact solution along with the approximate solution. The input should be: n, the number of subintervals into which the interval [0,5] should be divided. The output should be a graph of the exact solution and the numerical solution and print the value of the maximum error between the true solution and the numerical solution. Note that the exact solution is given by u(t) = 2tet. So far I have written the code:
Unsure if this is right. Thanks for any help! More answer... |
![]() |
![]() |