Está en la página 1de 5

function [f]=ecdiferencial(w,x)

R=128.01;
V=178.01;
M0=10;
Lna=228.01;
Lnb=128.01;
F=100;
z=0.55;
B=0.1;
a=2;
t=10;
MB=100;
MD=100;
M20=eval(dsolve('DM20=R-(Lnb+(M20-M0)/B)','M20(0)=10','t'));L20=Lnb+(M20M0)/B;
M19=eval(dsolve('DM19=(Lnb+(M20-M0)/B)-(Lnb+(M19M0)/B)','M19(0)=10','t'));L19=Lnb+(M19-M0)/B;
M18=eval(dsolve('DM18=(Lnb+(M19-M0)/B)-(Lnb+(M18M0)/B)','M18(0)=10','t'));L18=Lnb+(M18-M0)/B;
M17=eval(dsolve('DM17=(Lnb+(M18-M0)/B)-(Lnb+(M17M0)/B)','M17(0)=10','t'));L17=Lnb+(M17-M0)/B;
M16=eval(dsolve('DM16=(Lnb+(M17-M0)/B)-(Lnb+(M16M0)/B)','M16(0)=10','t'));L16=Lnb+(M16-M0)/B;
M15=eval(dsolve('DM15=(Lnb+(M16-M0)/B)-(Lnb+(M15M0)/B)','M15(0)=10','t'));L15=Lnb+(M15-M0)/B;
M14=eval(dsolve('DM14=(Lnb+(M15-M0)/B)-(Lnb+(M14M0)/B)','M14(0)=10','t'));L14=Lnb+(M14-M0)/B;
M13=eval(dsolve('DM13=(Lnb+(M14-M0)/B)-(Lnb+(M13M0)/B)','M13(0)=10','t'));L13=Lnb+(M13-M0)/B;
M12=eval(dsolve('DM12=(Lnb+(M13-M0)/B)-(Lnb+(M12M0)/B)','M12(0)=10','t'));L12=Lnb+(M12-M0)/B;
M11=eval(dsolve('DM11=(Lnb+(M12-M0)/B)-(Lnb+(M11M0)/B)','M11(0)=10','t'));L11=Lnb+(M11-M0)/B;
M10=eval(dsolve('DM10=(Lna+(M11-M0)/B)-(Lna+(M10-M0)/B)
+F','M10(0)=10','t'));L10=Lna+(M10-M0)/B;
M9=eval(dsolve('DM9=(Lna+(M10-M0)/B)-(Lna+(M9M0)/B)','M9(0)=10','t'));L9=Lna+(M9-M0)/B;
M8=eval(dsolve('DM8=(Lna+(M9-M0)/B)-(Lna+(M8M0)/B)','M8(0)=10','t'));L8=Lna+(M8-M0)/B;
M7=eval(dsolve('DM7=(Lna+(M8-M0)/B)-(Lna+(M7M0)/B)','M7(0)=10','t'));L7=Lna+(M7-M0)/B;
M6=eval(dsolve('DM6=(Lna+(M7-M0)/B)-(Lna+(M6M0)/B)','M6(0)=10','t'));L6=Lna+(M6-M0)/B;
M5=eval(dsolve('DM5=(Lna+(M6-M0)/B)-(Lna+(M5M0)/B)','M5(0)=10','t'));L5=Lna+(M5-M0)/B;
M4=eval(dsolve('DM4=(Lna+(M5-M0)/B)-(Lna+(M4M0)/B)','M4(0)=10','t'));L4=Lna+(M4-M0)/B;
M3=eval(dsolve('DM3=(Lna+(M4-M0)/B)-(Lna+(M3M0)/B)','M3(0)=10','t'));L3=Lna+(M3-M0)/B;
M2=eval(dsolve('DM2=(Lna+(M3-M0)/B)-(Lna+(M2M0)/B)','M2(0)=10','t'));L2=Lna+(M2-M0)/B;
M1=eval(dsolve('DM1=(Lna+(M2-M0)/B)-(Lna+(M1M0)/B)','M1(0)=10','t'));L1=Lna+(M1-M0)/B;
b=L1+V;
f(1)=(L2*x(2)-L1*x(1)+V*(a*x(22)/(1+(a-1)*x(22))-a*x(1)/(1+(a1)*x(1))))/M1;

f(2)=(L3*x(3)-L2*x(2)+V*(a*x(1)/(1+(a-1)*x(1))-a*x(2)/(1+(a1)*x(2))))/M2;
f(3)=(L4*x(4)-L3*x(3)+V*(a*x(2)/(1+(a-1)*x(2))-a*x(3)/(1+(a1)*x(3))))/M3;
f(4)=(L5*x(5)-L4*x(4)+V*(a*x(3)/(1+(a-1)*x(3))-a*x(4)/(1+(a1)*x(4))))/M4;
f(5)=(L6*x(6)-L5*x(5)+V*(a*x(4)/(1+(a-1)*x(4))-a*x(5)/(1+(a1)*x(5))))/M5;
f(6)=(L7*x(7)-L6*x(6)+V*(a*x(5)/(1+(a-1)*x(5))-a*x(6)/(1+(a1)*x(6))))/M6;
f(7)=(L8*x(8)-L7*x(7)+V*(a*x(6)/(1+(a-1)*x(6))-a*x(7)/(1+(a1)*x(7))))/M7;
f(8)=(L9*x(9)-L8*x(8)+V*(a*x(7)/(1+(a-1)*x(7))-a*x(8)/(1+(a1)*x(8))))/M8;
f(9)=(L10*x(10)-L9*x(9)+V*(a*x(8)/(1+(a-1)*x(8))-a*x(9)/(1+(a1)*x(9))))/M9;
f(10)=(L11*x(11)-L10*x(10)+V*(a*x(9)/(1+(a-1)*x(9))-a*x(10)/(1+(a1)*x(10)))+F*z)/M10;
f(11)=(L12*x(12)-L11*x(11)+V*(a*x(10)/(1+(a-1)*x(10))-a*x(11)/(1+(a1)*x(11))))/M11;
f(12)=(L13*x(13)-L12*x(12)+V*(a*x(11)/(1+(a-1)*x(11))-a*x(12)/(1+(a1)*x(12))))/M12;
f(13)=(L14*x(14)-L13*x(13)+V*(a*x(12)/(1+(a-1)*x(12))-a*x(13)/(1+(a1)*x(13))))/M13;
f(14)=(L15*x(15)-L14*x(14)+V*(a*x(13)/(1+(a-1)*x(13))-a*x(14)/(1+(a1)*x(14))))/M14;
f(15)=(L16*x(16)-L15*x(15)+V*(a*x(14)/(1+(a-1)*x(14))-a*x(15)/(1+(a1)*x(15))))/M15;
f(16)=(L17*x(17)-L16*x(16)+V*(a*x(15)/(1+(a-1)*x(15))-a*x(16)/(1+(a1)*x(16))))/M16;
f(17)=(L18*x(18)-L17*x(17)+V*(a*x(16)/(1+(a-1)*x(16))-a*x(17)/(1+(a1)*x(17))))/M17;
f(18)=(L19*x(19)-L18*x(18)+V*(a*x(17)/(1+(a-1)*x(17))-a*x(18)/(1+(a1)*x(18))))/M18;
f(19)=(L20*x(20)-L19*x(19)+V*(a*x(18)/(1+(a-1)*x(18))-a*x(19)/(1+(a1)*x(19))))/M19;
f(20)=(R*x(21)-L20*x(20)+V*(a*x(19)/(1+(a-1)*x(19))-a*x(20)/(1+(a1)*x(20))))/M20;
f(21)=(V*a*x(20)/(1+(a-1)*x(20))-V*x(21))/MD;
f(22)=(L1*x(1)-V*a*x(22)/(1+(a-1)*x(22))-b*x(22))/MB;
f=f';

clc;clear all
tr=0:1:10;
x0=[0.035,0.05719,0.08885,0.1318,0.18622,0.24951,0.31618,0.37941,0.43391,
0.47688,0.51526,0.56295,0.61896,0.68052,0.74345,0.80319,0.85603,0.89995,0
.93458,0.96079,0.98,0.02];
[w,x]=ode15s('ecdiferencial',tr,x0)

w=

0
1
2
3
4
5
6
7
8
9
10

x=

x1

x2

x3

x4

x5

x6

x7

0.0350

0.0572

0.0888

0.1318

0.1862

0.2495

0.3162

0.0934

0.1501

0.1998

0.2390

0.2670

0.2851

0.2954

0.0898

0.1420

0.1867

0.2215

0.2465

0.2633

0.2739

0.0824

0.1309

0.1734

0.2076

0.2331

0.2511

0.2632

0.0779

0.1243

0.1657

0.1995

0.2254

0.2442

0.2573

0.0754

0.1207

0.1613

0.1950

0.2212

0.2404

0.2540

0.0741

0.1187

0.1590

0.1925

0.2188

0.2383

0.2522

0.0733

0.1176

0.1576

0.1911

0.2175

0.2371

0.2512

0.0729

0.1170

0.1569

0.1903

0.2167

0.2364

0.2506

0.0726

0.1166

0.1564

0.1899

0.2162

0.2360

0.2502

0.0725

0.1164

0.1561

0.2357

x12

x13

0.2500

x9

0.3794

0.4339

0.4769

0.5153

0.5629

0.6190

0.6805

0.3001

0.3011

0.2999

0.3330

0.3820

0.4496

0.5343

0.2802

0.2836

0.2852

0.3024

0.3296

0.3706

0.4291

0.2710

0.2759

0.2789

0.2893

0.3061

0.3325

0.3727

0.2661

0.2719

0.2756

0.2826

0.2941

0.3127

0.3419

0.2634

0.2697

0.2738

0.2790

0.2876

0.3017

0.3246

0.2619

0.2685

0.2729

0.2770

0.2840

0.2956

0.3146

0.2610

0.2678

0.2723

0.2758

0.2818

0.2918

0.3084

0.2605

0.2673

0.2720

0.2751

0.2804

0.2895

0.3045

0.2602

0.2671

0.2717

0.2746

0.2796

0.2880

0.3020

0.2669

x15

x16

x11

0.2160

x8

0.2600

x10

0.1896

0.2716

0.2743

x17

x18

0.2790

x19

x14

0.2870

x20

0.3003

xD

0.7435

0.8032

0.8560

0.9000

0.9346

0.9608

0.9800

0.6290

0.7228

0.8053

0.8712

0.9200

0.9547

0.9791

0.5063

0.5985

0.6965

0.7887

0.8664

0.9263

0.9698

0.4307

0.5082

0.6025

0.7047

0.8027

0.8865

0.9517

0.3863

0.4501

0.5347

0.6362

0.7440

0.8450

0.9291

0.3604

0.4141

0.4895

0.5862

0.6969

0.8080

0.9062

0.3450

0.3918

0.4600

0.5515

0.6616

0.7780

0.8857

0.3354

0.3776

0.4407

0.5277

0.6361

0.7551

0.8688

0.3292

0.3683

0.4276

0.5112

0.6179

0.7380

0.8557

0.3251

0.3622

0.4188

0.4998

0.6049

0.7254

0.8457

0.3224

xB
0.0200
0.0350
0.0350
0.0320
0.0302
0.0291
0.0286
0.0282
0.0281
0.0280
0.0279

0.3580

0.4128

0.4919

0.5957

0.7163

0.8383