- Do you receive warning and/or error messages? If so the full and exact text of those messages (all the text displayed in orange and/or red in the Command Window) may be useful in determining what's going on and how to avoid the warning and/or error.
- Does it do something different than what you expected? If so, what did it do and what did you expect it to do?
- Did MATLAB crash? If so please send the crash log file (with a description of what you were running or doing in MATLAB when the crash occured) to Technical Support using the telephone icon in the upper-right corner of this page so we can investigate.
solution with the Runge-Kutta method HELPP
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
for i=1:(length(x)-1) % calculation loop
k_1 = F_xy(x(i),y(i));
k_2 = F_xy(x(i)+0.5*h,y(i)+0.5*h*k_1);
k_3 = F_xy((x(i)+0.5*h),(y(i)+0.5*h*k_2));
k_4 = F_xy((x(i)+h),(y(i)+k_3*h));
y(i+1) = y(i) + (1/6)*(k_1+2*k_2+2*k_3+k_4)*h; % main equation
end
Employ the Classical RK-4 method to integrate the given equations from x=0 to x=1 using at least one single step with the initial conditions, y(0)=2 and z(0)=4.
1 comentario
Steven Lord
el 25 de Jun. de 2020
What help do you need?
Respuestas (1)
James Tursa
el 25 de Jun. de 2020
This is clearly a homework/exam question, so I will only offer hints. The code you have posted is for a single scalar differential equation. But you have two of these equations. You can either duplicate the stuff inside the loop for the z equation, or you can turn the code into a vector form that can handle any number of equations. I prefer the second approach because it is less code to write, and once you have written it, it will work for any number of equations. But either approach can work.
0 comentarios
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!