Está en la página 1de 12

Clase 2:

Dando tiempo iniciasl y final;:; solucin analtica


>> tspan= (0:10:64000)';
>> [t,h]=ode ('tanque',tspan,20);
??? Undefined function or variable 'ode'.

>> [t,h]=ode45 ('tanque',tspan,20);


>> plot(t,h)

Cambiando el valor de los egundos:


>> tspan= (0:10:65000)';
>> [t,h]=ode45 ('tanque',tspan,20);
>> plot(t,h)
Warning: Imaginary parts of complex X and/or Y arguments ignored.

Probando con 62000 segundos:

Tiempo de vaceamiento de tanque:


>> 62000/3600

ans =

17.2222 horas

SEGUNDO PROBLEMA:

>> flash
Calculo de la fraccion de vaporizacion
con el metodo de Newton Raphson

Ingrese el numero de componentes: 2


Ingrese la composicion de la alimentacion, [ ]: [0.4 0.6]
Ingrese las constantes de equilibrio, [ ]: [1.776 0.732]

Ingrese el valor inicial: 0.5


N

fx

0.70795593

1.8861e-003

0.71931943

3.6386e-006

La raiz es: 0.71931943


El numero de iteraciones es: 2
En este caso el alfa es=0.71931943

Otro problema con temperatura de rocio:


Inline function:
a(t) = 0.4*101.325/(10^(6.01788-1203.677/(t+219.904)))+0.6*101.325/(10^(6.084361347.620/(t+219.787)))-1

>> x= fzero(a,100,optimset('disp','iter','tolx',1e-4))

Func-count

f(x)

100

97.1716

102.828 -0.0384916

Procedure

0.0448171
0.137045

initial
search
search

Looking for a zero in the interval [97.1716, 102.8284]

101.588 -0.0029878

interpolation

101.486 6.63393e-006

interpolation

101.506 -0.000589167

interpolation

Zero found in the interval: [97.1716, 102.8284].

x=

101.4858

Problema de unidad de divisor:

Problema de euler
>> Solucion de una Ecuacion Diferencial
con el metodo de Euler

Ingrese el numero de puntos: 30


Ingrese el tiempo inicial y final, [ ]: [0 10]
Ingrese el valor inicial: 31.65
i
0

yi
31.65000000

28.31620000

25.33356027

22.66509192

20.27770224

18.14178427

16.23084966

14.52120016

12.99163374

11.62318166

10

10.39887319

11

9.30352521

12

8.32355389

13

7.44680621

14

6.66240929

15

5.96063551

16

5.33278191

17

4.77106221

18

4.26851033

19

3.81889390

20

3.41663708

21

3.05675131

22

2.73477350

23

2.44671069

24

2.18899050

25

1.95841684

26

1.75213026

27

1.56757254

28

1.40245490

29

1.25472965

30

1.12256479

Tomando 10 puntos:
>> euler1
Solucion de una Ecuacion Diferencial
con el metodo de Euler

Ingrese el numero de puntos: 10


Ingrese el tiempo inicial y final, [ ]: [0 10]
Ingrese el valor inicial: 31.65
i

yi

31.65000000

21.64860000

14.80764240

10.12842740

6.92784434

4.73864553

3.24123354

2.21700374

1.51643056

1.03723850

10

0.70947114

Ver q los valores estn entre 6 y 7 dias


Otro problema con A B C

Primero en e mfile
function y= reaccion (t,c)
k1=3; k2=1;
y(1)=-k1*c(1);
y(2)=k1*c(1)-k2*c(2);
y(3)=k2*c(2);
y=y';
espacio
>> tspan= (0:0.1:10);
>> [t,c]=ode45 ('reaccion',tspan,[1 0 0])

t=

0.0000 0.0001 0.9999


0.0000 0.0001 0.9999
0.0000 0.0001 0.9999
0.0000 0.0001 0.9999
0.0000 0.0001 0.9999

Modificando en el mfile
function y= reaccion (t,c)
k1=1; k2=3;
y(1)=-k1*c(1);
y(2)=k1*c(1)-k2*c(2);
y(3)=k2*c(2);
y=y';
ahora en el matbal

Probando con otro mfile


function y= reaccion (t,c)
k1=1; k2=1;
y(1)=-k1*c(1);
y(2)=k1*c(1)-k2*c(2);
y(3)=k2*c(2);
y=y';
en el mat lab

Problema con intercambiadores de calor

Ultimo problema
>> tspan= (0:0.1:10)';
>> [t,x]=ode45 ('destilacion',tspan,0.3)

t = 0.4178
0.4181
0.4184

También podría gustarte