matlab/octave 中的动画绘图/轨迹 [英] animate plot / trajectory in matlab / octave

查看:60
本文介绍了matlab/octave 中的动画绘图/轨迹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 matlab/octave 为这个螺旋设置动画,我希望它向上或向下螺旋

I'm trying to animate this spiral using matlab / octave I want it to spiral up or down

t = 0:0.1:10*pi;
r = linspace (0, 1, numel (t));
z = linspace (0, 1, numel (t));
plot3 (r.*sin(t), r.*cos(t), z);

我尝试使用 for 循环为其设置动画,但这只是给了我一个圆锥形状,请参阅下面的代码和图像

I tried using a for loop to animate it but that just gives me a cone shape see code and image below

clear all, clc,clf,tic
t = 0:0.1:10*pi;
r = linspace (0, 1, numel (t));
z = linspace (0, 1, numel (t));

for ii=1:length(r)
    ii
    plot3 (r.*sin(t(ii)), r.*cos(t(ii)), z);
    hold on
    %pause (.00001)
end

图像

推荐答案

以下似乎适用于 Octave 3.6.2

The following appears to work in Octave 3.6.2

t = 0:0.1:10*pi;
r = linspace (0, 1, numel (t));
z = linspace (0, 1, numel (t));

figure
axis([-1 1 -1 1 0 1])
hold on

for ii=1:length(r)
    plot3 (r(ii)*sin(t(ii)), r(ii)*cos(t(ii)), z(ii),'*');
    pause (.001)
end

这篇关于matlab/octave 中的动画绘图/轨迹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆