
ode 45 doesnt work
    4 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Naor t
 el 2 de Mayo de 2021
  
    
    
    
    
    Respondida: Cris LaPierre
    
      
 el 3 de Mayo de 2021
            Hey' so im tring to solve this eq


this is the code' what im missing? why it dosent work?
y0 = [-1 ;8]; 
tspan = [0 ;3];
[t,y] = ode45(@(t,y) ((2*y^2*t + 4)/((3-t^2*y)*2)),tspan,y0);
plot(t,y)
grid on
xlabel('t')
ylabel('y')
title('Solutions of (2*y^2*t + 4)/((3-t^2*y)*2','interpreter','latex')
0 comentarios
Respuesta aceptada
  William Rose
      
 el 3 de Mayo de 2021
        
      Editada: William Rose
      
 el 3 de Mayo de 2021
  
      It doesn;t work because you define y0=[-1 8], a vector with 2 elements. Therefore ode45() gets into trouble when it tries to square this vector as it evaluates dydt.
If you define y0=-1 it works. See result below.

0 comentarios
Más respuestas (1)
  Cris LaPierre
    
      
 el 3 de Mayo de 2021
        There is an issue with your initial conditions. See this post on how to set up an initial value problem when t ~= 0.
However, you may want to revisit either your equation or your initial values, as the result seems incorrect. Y values are extremely big.
y0 = 8; 
tspan = [-1 3];
[t,y] = ode45(@(t,y) ((2*y^2*t + 4)/((3-t^2*y)*2)),tspan,y0);
plot(t,y)
grid on
xlabel('t')
ylabel('y')
title('Solutions of (2*y^2*t + 4)/((3-t^2*y)*2')
0 comentarios
Ver también
Categorías
				Más información sobre Ordinary Differential Equations en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



