SciLab中的动画

时间:2016-12-09 20:09:25

标签: scilab

我想用SciLab绘制一个简单弹簧质量系统的轨迹。我已成功设法绘制x与t的图形。现在我想制作一个关于时间的身体轨迹的gif(像这样https://www.youtube.com/watch?v=kAl4XATyke4)。我该怎么办呢?附件是我到目前为止的进展。

//Input the spring constant k, mass m. and the initial values of x and x dot. The code will plot both x (in red) and x dot (in green)

function sol = spingmass(k,m,x_initial,xdot_initial,time)
osqr = k/m;

function dx = f(t,x)
    dx(1)=x(2);
    dx(2)=-1*osqr*x(1);
endfunction

t = 0:0.1:10;
sol = ode([x_initial;xdot_initial],time,t,f);
clf;
plot(t,sol(1,:),'r');
plot(t,sol(2,:),'g');
//disp(sol);

endfunction

1 个答案:

答案 0 :(得分:0)

借助 animaGIF 工具箱@https://atoms.scilab.org/toolboxes/animaGIF

,您将能够使用一系列图形的 Scilab 快照构建动画 GIF

这是一个独立的工具箱。不需要像 imageMagick 或其他 GIMP 这样的依赖项。

工具箱的单个 animaGIF() 函数被广泛记录。 该文档包括一些动画 GIF 图,在 Scilab 帮助浏览器中移动。享受!