Implementation of numerical method

1 次查看(过去 30 天)
evi
evi 2015-4-1
Hello!!! We have the ode y'=y+4π cos (4πt)y, t in [0,1], y(0)=1. The exact solution is y(t)=e^(t+sin (4 π t)).
I have to implement the following numerical method
y^(n+1)=y^n+h * [rho* f(t^n,y^n)+(1-rho) *f(t^(n+1),y^(n+1))] , n=0,....,N-1 , y^0=y_0
for a uniform partition of [a,b] with step h=(b-a)/N.
I have to use the Newton method to find y^(n+1). Ihave to find also the total error of the method and the local error.
I implemented the method as followsed: http://pastebin.com/ShyrmEAJ Is it right?
  1 个评论
John D'Errico
John D'Errico 2015-4-1
编辑:John D'Errico 2015-4-1
Please just use the normal attachment tool (the paper clip button.) Links to other sites for this purpose should be discouraged.
Anyway, asking if your code is "right" is difficult, since it forces us to test it, to compare the results, to carefully read your code to look for problems, figure out how you wrote the code, etc. You should do all of that yourself, and since you already know the answer, you can verify if it worked.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by