安荷 发表于 2008-10-17 11:08

单摆画相图程序,请大家帮忙调试一下

> restart;

> pendphaseplot := proc (c, k, ui, uf, n1, vi, vf, n2, ti, tf, n, vu, vv) local s, i, a, j, b, sys, fcns, q, p; end proc;

> s := {};

>
> for i from 0 to n1 do;
> a := ui+i*(uf-ui)/n1;
> for j from 0 to n2 do;
> b := vi+j*(vf-vi)/n2;
> sys := diff(u(t), t) = v(t), diff(v(t), t) = -k*sin(u(t))-c*v(t);
> fcns := {u(t), v(t)};
> q := dsolve({sys, u(0) = a, v(0) = b}, fcns, type = numeric, method = rkf45);
> p := plots(q, , ti, tf, numpoints = n, view = , scaling = constrained);
> od:

> od:

> plots();
> end:
> pendphaseplot(0, 2, -4, 4, 10, -3, 3, 6, -5, 5, 100, -10 .. 10, -5 .. 5);
以上是画单摆的相图的程序,总是出错,希望得到高人指教QQ:296620565 请注明:maple

[ 本帖最后由 无水1324 于 2008-10-25 11:59 编辑 ]

MathPen001 发表于 2008-10-21 14:37

附件是从http://www.maplesoft.com/applications/找到的,也许有用。

论坛对附件大小和类型有所限制,所以我用Maple另存为word文件,图片和输出结果删除了。用Maple工作表读一下。



[ 本帖最后由 MathPen001 于 2008-10-21 14:48 编辑 ]
页: [1]
查看完整版本: 单摆画相图程序,请大家帮忙调试一下