| 查看: 3563 | 回復(fù): 10 | |||
shidoudou新蟲(chóng) (初入文壇)
|
[求助]
matlab 求指點(diǎn) 動(dòng)力學(xué)方程擬合過(guò)程中導(dǎo)數(shù)的獲取
|
|
本人matlab不通,勉強(qiáng)做了一個(gè)程序能夠達(dá)到預(yù)期目的,可是老師想要中間運(yùn)算的導(dǎo)數(shù)值,也就是dxdt的值,不知道如何填補(bǔ)表達(dá)式實(shí)現(xiàn),望各位高手出手相助,不勝感激。 主程序: format short global Umax Ks Kp Y1 Y2 Uo Ko D Ux Kx Ku Ki; Ki=0.0001;Ku=0.0006; k0=[0.2 0.5 0.1 10 10 0.01 0.01 0.1 0.01 0.01]; %參數(shù)的初始值 x0=[0.0514 0.250 0]; %菌體濃度、底物濃度和產(chǎn)物濃度的初始值 t1=[0 6 12 18 24 30 36 42 48 54 60 66]';%發(fā)酵時(shí)間的實(shí)驗(yàn)數(shù)據(jù) tspan=[0 6 12 18 24 30 36 42 48 54 60 66 ]';%時(shí)間間隔 %yexp實(shí)驗(yàn)數(shù)據(jù)[菌體濃度x1、底物濃度x2和產(chǎn)物濃度x3] yexp=[[0.0514 0.0711 0.0997 0.1887 0.3478 0.6634 0.8711 1.1023 1.2336 1.4239 1.5849 1.6739];[0.25 0.2447 0.2366 0.2258 0.2196 0.203 0.1872 0.1698 0.1453 0.1124 0.0855 0.0608];[0 0.0012 0.0021 0.0039 0.0088 0.0137 0.0183 0.0268 0.0361 0.0438 0.0557 0.0643]]'; lb=[0 0 0 0 0 0.0216 0.001 0 0.001 0.001];ub=[1 10 10 50 50 2 1 1 0.1 0.1];%參數(shù)的下、上限 [k,resnorm,residual,exitflag,output,lambda,jacobian]=lsqnonlin(@ObjFunc4LNL103,k0,lb,ub,[],x0,yexp);%非線性擬合 y1=[yexp(:,1)];y2=[yexp(:,2)];y3=[yexp(:,3)]'; [t4plot,x4plot]=ode45(@kineticseqs103,[0 100],x0,[],k); plot(t1,y1,'b*',t4plot,x4plot(:,1),'k-'),xlabel('T(h)'),ylabel('Cx/(g/L)'); figure plot(t1,y2,'g*',t4plot,x4plot(:,2),'k-'),xlabel('T(h)'),ylabel('Cs/(mmol/L)'); figure plot(t1,y3,'r*',t4plot,x4plot(:,3),'k-'),xlabel('T(h)'),ylabel('Cp/(mmol/L)'); disp(k) 子程序: 1) function f=ObjFunc4LNL103(k,x0,yexp) tspan=[0 6 12 18 24 30 36 42 48 54 60 66]; [t1,x]=ode45(@kineticseqs103,tspan,x0,[],k); y(:,1)=x(:,1);y(:,2)=x(:,2);y(:,3)=x(:,3); f1=y(: ,1)-yexp(: ,1);f2=y(: ,2)-yexp(: ,2);f3=y(: ,3)-yexp(: ,3); f=[f1*1 f2*5 f3*10]; 2) function dxdt=kineticseqs103(t,x,k) %模型方程 global Umax Ks Kp Y1 Y2 Uo Ko D Ux Kx Ku Ki Umax=k(1); Ks=k(2); Kp=k(3); Y1=k(4); Y2=k(5); Ux=k(6); Kx=k(7); D=k(8); Uo=k(9); Ko=k(10); dxdt1=Umax*x(2)*x(1)*(1-Kp*x(3))/(Ks+x(2)); if dxdt1<0 dxdt1=0; end dxdt2=-1/Y1*dxdt1-Ux*x(2)*x(1)/(Kx+x(2))*(Ki/(Ki+x(3))); dxdt3=D*(-dxdt2-1/Y2*dxdt1-Uo*x(2)*x(1)/(Ko+x(2))*(Ku/(Ku+x(3)))); if dxdt3<0 dxdt3=0; end dxdt=[dxdt1;dxdt2;dxdt3]; 只要能顯示對(duì)應(yīng)時(shí)間t1,這些點(diǎn)的dxdt值就可以了。謝謝 |
matlab |
鐵桿木蟲(chóng) (職業(yè)作家)
新蟲(chóng) (初入文壇)
送鮮花一朵 |
非常感謝您哈。 我的本來(lái)的目的就是,建立了 微生物發(fā)酵的動(dòng)力學(xué)方程,是三個(gè)微分方程,然后利用實(shí)驗(yàn)所得的數(shù)據(jù)就是yexp那組數(shù)據(jù),非線性擬合微分方程里面的參數(shù)即可,以上的程序可以實(shí)現(xiàn)這個(gè)了。可是,老師讓我能夠顯示這三個(gè)微分方程在對(duì)應(yīng)的時(shí)間點(diǎn)t1那幾個(gè)點(diǎn)處的導(dǎo)數(shù)值,我就不知道怎么樣加語(yǔ)句了。不知道我表達(dá)清楚了沒(méi)有~ |
實(shí)習(xí)版主 (著名寫(xiě)手)
DOE鍋爐工

新蟲(chóng) (初入文壇)
鐵桿木蟲(chóng) (著名寫(xiě)手)
方丈大師
鐵桿木蟲(chóng) (著名寫(xiě)手)
方丈大師
木蟲(chóng) (正式寫(xiě)手)

新蟲(chóng) (初入文壇)
新蟲(chóng) (初入文壇)
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 材料專(zhuān)碩英一數(shù)二306 +3 | z1z2z3879 2026-03-18 | 3/150 |
|
|---|---|---|---|---|
|
[考研] 26調(diào)劑/材料/英一數(shù)二/總分289/已過(guò)A區(qū)線 +7 | 步川酷紫123 2026-03-13 | 7/350 |
|
|
[考研] 266求調(diào)劑 +5 | 陽(yáng)陽(yáng)哇塞 2026-03-14 | 9/450 |
|
|
[考研] 0703化學(xué)調(diào)劑 +4 | pupcoco 2026-03-17 | 7/350 |
|
|
[考研] 293求調(diào)劑 +11 | zjl的號(hào) 2026-03-16 | 16/800 |
|
|
[考研] 326求調(diào)劑 +5 | 上岸的小葡 2026-03-15 | 6/300 |
|
|
[考研] 085601求調(diào)劑 +4 | Du.11 2026-03-16 | 4/200 |
|
|
[考研] 085600材料與化工求調(diào)劑 +5 | 緒幸與子 2026-03-17 | 5/250 |
|
|
[考研] 304求調(diào)劑 +4 | ahbd 2026-03-14 | 4/200 |
|
|
[考研] 中科院材料273求調(diào)劑 +4 | yzydy 2026-03-15 | 4/200 |
|
|
[考研] 285求調(diào)劑 +6 | ytter 2026-03-12 | 6/300 |
|
|
[考研]
|
笨笨兔子 2026-03-12 | 3/150 |
|
|
[考研] 070305求調(diào)劑 +3 | mlpqaz03 2026-03-14 | 4/200 |
|
|
[考研] 288求調(diào)劑 +4 | 奇點(diǎn)0314 2026-03-14 | 4/200 |
|
|
[考研] 329求調(diào)劑 +3 | miaodesi 2026-03-12 | 4/200 |
|
|
[考研] 26調(diào)劑/材料科學(xué)與工程/總分295/求收留 +9 | 2026調(diào)劑俠 2026-03-12 | 9/450 |
|
|
[碩博家園] 085600 260分求調(diào)劑 +3 | 天空還下雨么 2026-03-13 | 5/250 |
|
|
[考研] 290求調(diào)劑 +7 | ADT 2026-03-12 | 7/350 |
|
|
[考博] 福州大學(xué)楊黃浩課題組招收2026年專(zhuān)業(yè)學(xué)位博士研究生,2026.03.20截止 +3 | Xiangyu_ou 2026-03-12 | 3/150 |
|
|
[考博] 26讀博 +4 | Rui135246 2026-03-12 | 10/500 |
|