help with ODE45, The solution can not be zero, circuit rlc
Ältere Kommentare anzeigen
function yptune = yptune(t,y,Vs,R,L,C,fo)
global Vs R L C fo;
wo=2*pi*fo;
algo=diff(square(wo*t),1);
algo=[algo 0];
yptune(1) = y(2);
yptune(2) = (Vs/L)*algo-(R/L)*y(2)-(1/(C*L))*y(1);
yptune = [yptune(1) ; yptune(2)];
__________________________________________________________________
global Vs R L C fo;
Vs=220;
R=10;
L=31.5e-3;
C=112e-6;
fo=60;
t=(0:0.00001:0.1);
options = odeset('RelTol', 1e-6);
t0 = 0;
tf = .1;
y0 = [0 0];
[tt y] = ode23t('yptune', t,y0,options);
plot(tt,y(:,2),'s','MarkerSize',1)
title( 'corriente')
xlabel('time')
ylabel('current')
grid on
[EDITED, Jan, code formatted - please do this by your own in the future - Thanks!]
1 Kommentar
Jan
am 24 Sep. 2012
You forgot to aks a question. Without a detailed description of the problem, suggesting a solution is too hard.
Antworten (0)
Kategorien
Mehr zu Ordinary Differential Equations finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!