[問題] 一個二階微分方程的問題已回收

看板MATLAB作者 (現在..就想見你..^^)時間16年前 (2010/02/06 11:21), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
我的問題是: Solve the IVP: Ut + Ux = exp(-t) U(x,0) = sinx Use MATLAB to produce a surface plot of the solution 這題要用surf 來畫solution的圖 下面是我寫的程式 m = 0; x = linspace(-5,5,100); t = linspace(0,2,20); sol = pdepe(m,@pdex1pde,@pdex1ic,@pdex1bc,x,t); u = sol(:,:,1); figure; surf(x,t,u); % -------------------------------------------------------------------------- function [c,f,s] = pdex1pde(x,t,u) c = 1; f = exp(-t); s = -1; % -------------------------------------------------------------------------- function u0 = pdex1ic(x) u0 = sin(x); % -------------------------------------------------------------------------- function [pl,ql,pr,qr] = pdex1bc(xl,ul,xr,ur,t) 但是我不知道如果沒有boundary condition該怎麼辦 畫的圖看起來怪怪的, 錯誤訊息如下: ??? function [c,f,s] = pdex1pde(x,t,u) | Error: Function definitions are not permitted at the prompt or in scripts. 不知道可不可以用別的方法來寫這題. 或者是我該怎麼改呢? 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 173.70.6.63
文章代碼(AID): #1BRE19UH (MATLAB)