using t in the ode function

1 visualización (últimos 30 días)
tomer polsky
tomer polsky el 31 de Dic. de 2017
Comentada: Walter Roberson el 1 de En. de 2018
hello i am using the function of ode 45 but if for exmpale I i want to give value by the change of t,for exmaple i have this code :
function [ zigzag_simulation] = find_zigzag( t,x)
global R R1 C C1 L1 L2 U Duty_cycle alpha R_C R2 R_C1 V_diode R_diode
global A_T B_T C_T D_T V_desire f tspan
global A_a A_b B_a B_b
t_off=((alpha+1)*(f))^(-1);
ratio=rem(t,(1/f));
end
is it posbiile to use t ? becouse i have an error

Respuestas (1)

Walter Roberson
Walter Roberson el 31 de Dic. de 2017
It is legal to use t in the ode function. However, you have used rem() in your calculations, which makes your output discontinuous. The ode function must be continuous to at least one more derivative than you use yourself or else MATLAB will detect the discontinuity. If the ode function is not continuous to at least one derivative further than that then ode45 will give the wrong answer but might not detect the discontinuity.
  2 comentarios
tomer polsky
tomer polsky el 1 de En. de 2018
so how can i solve this problem ? I am sorry for my english it is not my first language
Walter Roberson
Walter Roberson el 1 de En. de 2018
We do not know how to fix the code. You have no comments in the code, and you did not give the equations to be solve.
Also, your function is defined as
function [ zigzag_simulation] = find_zigzag( t,x)
but you do not assign anything to zigzag_simulation.

Iniciar sesión para comentar.

Categorías

Más información sobre Ordinary Differential Equations en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by