zxqk.net
当前位置:首页 >> mAtlAB解微分方程组例题 >>

mAtlAB解微分方程组例题

function dz=caonim(t,z) %保存为 caonim.m 文件dz=[-z(1)^3-z(2);z(1)-z(2)^3];------------------------------------运行[T,Z]=ode45('caonim',[0 30],[1,0.5]);plot(T,Z)legend('x-t','y-t')------------------------

1.>>[x,y]=dsolve('D2x+2*Dx=x+2*y-exp(-t)','Dy=4*x+3*y+4*exp(-t)') 或者 >>a='D2x+2*Dx=x+2*y-exp(-t)'; >>b='Dy=4*x+3*y+4*exp(-t)'; >>[x,y]=dsolve(a,b) 自变量用t就可以,不用换成x.因为Dx,Dy都是对t求导.2.这

解析解:[x,y]=dsolve('Dx=x-y-x*(x^2+y^2)', 'Dy=x+y-y*(x^2+y^2)','x(0)=2','y(0)=1')得到的结果是解析解没有找到.用数值解.在Matlab下输入:edit,然后将下面两行百分号之间的内容,复制进去,保存 %%%%%%%%%%%%%%%%%%%%%%%

昨天不是回了一个吗?在Matlab下输入:edit,然后将下面两行百分号之间的内容,复制进去,保存 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function

[x y]=dsolve('D2x=(x*x+3*x)*Dy','D2y=-(x*x+3*x)*Dx','x(0)=0','y(0)=0','Dx(0)=a','Dy(0)=a','D2x(0)=a','D2y(0)=a')%%%%%%%%%%%%%%%%%%%%%%%%%%%设定的X(1)=dx/dt;x(2)=x;x(3)=dy/dt;x(4)=y;%%%%%%%function dx=

>> syms x(t) y(t) r d a b r='1';d='0.5';a='0.1';b='0.02'; [x,y]=dsolve(diff(x)==(r-a*y)*x,diff(y)==-(d-b*x)*y,x(0)==25,y(0)==2) warning: explicit solution could not be found. > in dsolve at 194 x = [ empty sym ] y = [] 说明无解.

这说明此微分方程没有显示解,应用数值方法求解,例如ode45等函数就一个例子(选自matlab帮助文档)解入下微分方程组1,建立方程组函数function dy = rigid(t,y)dy = zeros(3,1); % a column vectordy(1) = y(2) * y(3);dy(2) = -y(1) * y(3);dy(3) = -0.51 * y(1) * y(2);2,求解并绘图[T,Y] = ode45(@rigid,[0 12],[0 1 1]);plot(T,Y(:,1),'-',T,Y(:,2),'-.',T,Y(:,3),'.')结果

这个好像是常微分方程组把,先建立一个调用式子的函数:function f=hanshu(y,x) f=[a(x(3)-x(2)); b(x(1)-0.5*sqrt(x(2)-c)); d(2.5-x(3))];然后:[x,y]=ode45('hanshu',[t_start,t_final],x0);plot(t,x);把初值和区间写上.感觉你的x1应该是x(1)把.我也正好做长微分方程,有空加我qq724918113

原发布者:旧街雨巷夜未停用Matlab求解微分方程借助Matlab软件,可以方便地求出微分方程(组32313133353236313431303231363533e78988e69d8331333433623739)的解析解和数值解.微分方程(组)的解析解求微分方程(组)解析

syms x yy=sqrt(2*pi/x)*sin(x);y1=diff(y,'x');y2=diff(y,'x',2);h=x^2*y2+x*y1+(x^2-1/2)*y;h=simplify(h)结果:h =-1/4/x*2^(1/2)*sin(x)*pi^(1/2)/(1/x)^(1/2)可见不等于0,=y,说明原答案有问题

网站首页 | 网站地图
All rights reserved Powered by www.zxqk.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com