Help with basic matlab
1 view (last 30 days)
Show older comments
I need to find the error between the exact solution and Euler, Runge Kuta 2 y 4.
I have the next IVP:
y' = sin(3t) - cos(t/10) + 3sen(7t) -ty
y(0)=0
I need to solve in an interval [0 20], t=0:h:20, where h = 5
But h is going to change until: abs [ (y(h)-y(h/2)/y(h) ] / n > 0.05
h = (5,5/2,5/4,...), and n = 5
The problem is not with RK2 and RK4 or how to solve the ivp, it is when I need to find the error and I need to evaluate the ivp in t=0:h:20, but i gives me an error, and it is mostly because of the -t*y part. I have been using the function eval.
Thanks alot for reading my problem
3 Comments
Walter Roberson
on 14 May 2013
No, it is because you did not use valid expression syntax in your strings. For example, 3t needs to be 3*t and 3sin(7*t) needs to be 3*sin(7*t)
Answers (0)
See Also
Categories
Find more on Performance and Memory in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!