using t in the ode function
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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
0 commentaires
Réponses (1)
Walter Roberson
le 31 Déc 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 commentaires
Walter Roberson
le 1 Jan 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.
Voir également
Catégories
En savoir plus sur Ordinary Differential Equations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!