Professional Documents
Culture Documents
[t,y]=ode45(dy,tspan,c.i.) donde:
=
{ =
. . =
=
=
Ejemplo, resolver la ecuacin = ( ), para un intervalo de tiempo 0<t<120, con las
= 0.03 1
condiciones iniciales { = 27
(0) = 84
Solucin con MATLAB:
>> % ejemplo, resolver la ecuacion dT/dt=-0.03*(T-27), para un rango de tiempo t[0,120], c.i.
To=84
dT =
@(t,T)-0.03*(T-27)
>> t=0:0.5:120;
>> [t,T]=ode45(dT,t,84);
>> plot(t,T)
>> % procedimeinto donde MATLAB, elige el vetor tiempo
>> dT=@(t,T)-0.03*(t-27)
dT =
@(t,T)-0.03*(t-27)
>> plot(t,T)
dT =
@(t,T)-0.03*(t-27)
>> [t,T]=ode45(dT,[0 120],84);
>> plot(t,T)
dT =
@(t,T)-0.03*(T-27)
>> plot(t,T)
>> T=dsolve('dT=-k*(T-Ta)','T(0)=T0')
Cannot identify differential equations. To solve algebraic equations, use 'solve' or 'vpasolve'.
T = feval(symengine,'symobj::dsolve',sys,x,options);
>> T=dsolve('DT=-k*(T-Ta)','T(0)=T0')
T=
Ta + exp(-k*t)*(T0 - Ta)
s = evalin('caller',vectorize(map2mat(char(x))));
>> tabla=[t,eval(T)]
s = evalin('caller',vectorize(map2mat(char(x))));
>> tabla=[t,eval(T)']
>> tabla=[t,eval(T)]
tabla =
0 84.0000
2.4678 79.9325
4.9356 76.1552
7.4035 72.6474
9.8713 69.3900
12.8713 65.7416
15.8713 62.4071
18.8713 59.3597
21.8713 56.5745
24.8713 54.0291
27.8713 51.7027
30.8713 49.5766
33.8713 47.6334
36.8713 45.8575
39.8713 44.2345
42.8713 42.7511
45.8713 41.3955
48.8713 40.1565
51.8713 39.0241
54.8713 37.9892
57.8713 37.0434
60.8713 36.1790
63.8713 35.3889
66.8713 34.6669
69.8713 34.0070
72.8713 33.4039
75.8713 32.8528
78.8713 32.3490
81.8713 31.8886
84.8713 31.4679
87.8713 31.0833
90.8713 30.7319
93.8713 30.4107
96.8713 30.1171
99.8713 29.8488
102.8713 29.6036
105.8713 29.3796
108.8713 29.1747
111.8713 28.9876
114.8713 28.8165
117.8713 28.6602
118.4035 28.6339
118.9356 28.6080
119.4678 28.5825
120.0000 28.5575
>> hold on
>> plot(t,eval(T))
Resolver el sistema de ecuaciones:
>> plot(t,y(:,1))
>> figure(2),plot(t,y(:,2))
>> % graficar la solucion en el espacio-fase
>> comet3(y(:,1),y(:,2),y(:,3))
>> box on