January 1st, 2011, 10:52 AM  #1 
Newbie Joined: Jan 2011 Posts: 1 Thanks: 0  System of odes, Problem
Hello, i would appretiate some help on this... My initial problem is y''=100y+sin(y), y(0)=0, y'(0)=1, tspan[0,20*pi] and i wanna solve it with Rungekutta 4 stage,for Xj, j = [0 20], then i ll use this 20 initial values for solving the equations with another method of order 15. I m pasting my code, and i hope someone can figure whats wrong.... xronos = [0 20*pi]; h = (xronos(2)xronos(1))/n; t_dian=(xronos(1):h:xronos(2))'; x(1) = 0; y(1) = 0; vx(1) = 1; vy(1) = 0; z(1,:)=[x(1) y(1) vx(1) vy(1)]; for j=1:20 initial_buffer(1,:)=z; akrivis_third = feval('methodosbuffer',initial_buffer(j,:),h,t_dia n,j); initial_buffer(j+1,:)=akrivis_third(j,:); end %methodosbuffer function buffer = methodosbuffer(z,h,t_dian,j) b=1; vima=h/6; test(1,:)=z; for a=t_dian(j):vima:t_dian(j+1) testbtonos(b,:)=feval('nonlinear1',test(b,:),t_dia n(j+1)); s1 = testbtonos(b,1:2); s2 = testbtonos(b,1:2) + ((vima/2)* s1); s3 = testbtonos(b,1:2) + ((vima/2)* s2); s4 = testbtonos(b,1:2) + vima * s3; test(b+1,1:2) = test(b,1:2) + (vima/6)* (s1 + 2*s2 + 2*s3 + s4); testbtonos(b,:)=feval('nonlinear1',test(b,:),t_dia n(j+1)); s5 = testbtonos(b,3:4); s6 = testbtonos(b,3:4) + ((vima/2)* s1); s7 = testbtonos(b,3:4) + ((vima/2)* s2); s8 = testbtonos(b,3:4) + vima * s3; test2(b+1,1:2) = test(b,1:2) + (vima/6)* (s5 + 2*s6 + 2*s7 + s8); buffer(j,:) =test(b+1,:); b=b+1; end %nonlinear1 function ztonos =nonlinear1(z,t) y=z(1); yp=z(3); ydp = 100*y + sin(y); ztonos= [yp 0 ydp 0]; Tnx, in advance. Last edited by greg1313; October 12th, 2014 at 07:17 PM. 

Tags 
odes, problem, system 
Thread Tools  
Display Modes  

Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
ODEs that are not quite simple for me.  Execross02  Applied Math  9  July 1st, 2013 09:15 AM 
System of ODEs in matrix form:rates vector problem  eride87  Applied Math  0  March 25th, 2013 08:57 AM 
Please solve the 6 ODEs...  singapore  Calculus  2  March 19th, 2012 07:48 PM 
Solve the following ODEs...  FreaKariDunk  Calculus  12  February 22nd, 2012 09:59 PM 
Solving system of nonlinear ODEs  thetouristbr  Calculus  0  March 16th, 2011 06:47 AM 