You are on page 1of 2

[t,x]=ode45(@s8ej1,[0 2*pi],3)

t =

0
0.1571
...
6.2832

x =

3.0000
3.0387
...
3.0000

A=[t x]

A =

0 3.0000
0.1571 3.0387
...
6.2832 3.0000

plot(t,x)

[t,x]=ode45(@funcionF,[0 10],[0 1]);

A=[t,x]

A =

0 0 1.0000
0.0001 0.0001 1.0000
...
10.0000 -0.2068 -0.2398

plot3(t,x(:,1),x(:,2))
grid
plot(t,x)

[t,x]=ode45(@ejercicio2sept,[0 1],[0 0.5]);


A=[t,x]

A =

0 0 0.5000
0.0001 0.0001 0.5002
...
1.0000 4.2959 14.5020
plot3(t,x(:,1),x(:,2))

y=dsolve('D2y-2*Dy-4*y-cos(t)=0','t')

y =

C1*exp(-t*(5^(1/2) - 1)) + C2*exp(t*(5^(1/2) + 1)) -


(5^(1/2)*exp(5^(1/2)*t - t)*exp(-t*(5^(1/2) - 1))*(sin(t) +
cos(t)*(5^(1/2) - 1)))/(10*((5^(1/2) - 1)^2 + 1)) + (5^(1/2)*exp(-
t - 5^(1/2)*t)*exp(t*(5^(1/2) + 1))*(sin(t) - cos(t)*(5^(1/2) +
1)))/(10*((5^(1/2) + 1)^2 + 1))

simplify(y)

ans =

C1*exp(-t*(5^(1/2) - 1)) - (2*sin(t))/29 - (5*cos(t))/29 +


C2*exp(t*(5^(1/2) + 1))

pretty(ans)
2 sin(t) 5 cos(t)
C1 exp(-t (sqrt(5) - 1)) - -------- - -------- + C2 exp(t (sqrt(5)
+ 1))
29 29

y=dsolve('D2y-2*Dy-4*y-cos(t)=0','Dy(0)=0.5','y(0)=0','t')

y =

(5^(1/2)*exp(t*(5^(1/2) + 1))*(4*5^(1/2) + 9))/(20*(2*5^(1/2) +


7)) - (5^(1/2)*exp(5^(1/2)*t - t)*exp(-t*(5^(1/2) - 1))*(sin(t) +
cos(t)*(5^(1/2) - 1)))/(10*((5^(1/2) - 1)^2 + 1)) + (5^(1/2)*exp(-
t - 5^(1/2)*t)*exp(t*(5^(1/2) + 1))*(sin(t) - cos(t)*(5^(1/2) +
1)))/(10*((5^(1/2) + 1)^2 + 1)) - (5^(1/2)*exp(-t*(5^(1/2) -
1))*(24*5^(1/2) - 61))/(20*(2*5^(1/2) - 7)*(2*5^(1/2) + 7)^2)

simplify(y)

ans =

(5*exp(t*(5^(1/2) + 1)))/58 + (5*exp(-t*(5^(1/2) - 1)))/58 -


(29^(1/2)*cos(t - atan(2/5)))/29 + (23*5^(1/2)*exp(t*(5^(1/2) +
1)))/580 - (23*5^(1/2)*exp(-t*(5^(1/2) - 1)))/580

vpa(ans,10)

ans =

0.1748785577*exp(3.236067977*t) - 0.1856953382*cos(t -
0.3805063771) - 0.002464764625*exp(-1.236067977*t)

You might also like