| 查看: 351 | 回复: 2 | |||
| 当前主题已经存档。 | |||
[交流]
【求助 】matlab程序问题 急
|
|||
|
function pdex4 clc clear m = 0; x = linspace(-50,150,30); t = linspace(0,250,30); u = inline('u(x,t)'); sol = pdepe(m,@pdex4pde,@pdex4ic,@pdex4bc,x,t); u1 = sol(:,:,1); u2 = sol(:,:,2); u3 = sol(:,:,3); u4 = sol(:,:,4); u5 = sol(:,:,5); u6 = sol(:,:,6); u7 = sol(:,:,7); figure(1) mesh(x,t,(abs(u7)).^2) title('(abs(a)).^2') xlabel('Distance x') ylabel('Time t') % A solution profile can also be illuminating. figure(2) surf(x,t,abs(u2),'FaceColor',[1 1 1]) title('u2(x,t)') xlabel('Distance x') ylabel('Time t') % A solution profile can also be illuminating. figure(3) plot(t,abs(u7(end, ))title('Solution at x =0 ') xlabel('time') ylabel('u7(0, ')% -------------------------------------------------------------- function [c,f,s] = pdex4pde(x,t,u,DuDx,DuDt) c = [1; 1; 1; 1; 1; 1; 1]; f = [0; 0; 0; 0; 0; 0; u]; ganmp=1.0; gam=0; g=1.0; gam1=2.0; gam2=2.0; cottht=10.*(1-0.5.*tanh(0.1.*(t-65))+0.5.*tanh(0.1.*(t-185))); y1=-(ganmp+i.*gam1).*u(1)-(i./2).*g.*(u(7).*(u(5)-u(4))-cottht.*u(2)); y2=i.*(gam2-gam1).*u(2)-(i./2).*g.*(u(7).*u(3)-cottht.*u(1)); y3=-(ganmp-i.*gam2).*u(3)-(i./2).*g.*(u(2).*conj(u(7))+cottht.*(u(6)-u(5))); y4=u(5)-(i./2).*g.*(u(7).*conj(u(1))-u(1).*conj(u(7))); y5=-(2+gam).*u(5)-(i./2).*g.*(u(1).*conj(u(7))-u(7).*conj(u(1))+cottht.*(conj(u(3))-u(3))); y6=u(5)-(i./2).*g.*cottht.*(u(3)-conj(u(3))); y7=(i./2).*g.*u(1); s = [y1; y2; y3; y4; y5; y6; y7]; % -------------------------------------------------------------- function u0 = pdex4ic(x); u0 = [0;0;0;1;0;0;0.01.*exp(-((x./15).^2))]; % -------------------------------------------------------------- function [pl,ql,pr,qr] = pdex4bc(xl,ul,xr,ur,t) pl = [ul(1); ul(2); ul(3); ul(4); ul(5); ul(6); 0]; ql = [0; 0; 0; 0; 0; 0; 1]; pr = [ur(1); ur(2); ur(3); ur(4); ur(5); ur(6); 0]; qr = [0; 0; 0; 0; 0; 0; 1]; 方程7 是 DuDt+DuDx=i=(i./2).*g.*u(1) ,是随空间变化的,但结果怎么不随空间变化了,谁能帮我改改这个程序。 感谢所有看到此程序的人,特别感谢帮我修改的人!!! [ Last edited by lvzhu2007 on 2008-4-19 at 15:25 ] |
» 猜你喜欢
投稿精细化工
已经有6人回复
博士读完未来一定会好吗
已经有36人回复
之前让一硕士生水了7个发明专利,现在这7个获批发明专利的维护费可从哪儿支出哈?
已经有10人回复
博士申请都是内定的吗?
已经有9人回复
心脉受损
已经有8人回复
读博
已经有5人回复
2楼2008-04-19 15:14:36
3楼2008-04-20 15:45:45













))
回复此楼