八度内的多个绘图调用

发布于 2024-12-21 09:35:45 字数 752 浏览 0 评论 0原文

我正在八度音程中工作,我需要调用 plot3 两次或多次才能生成一张图表。但它只绘制了 plot3 的最后一次调用。我需要一些帮助。

这是我的代码: 它只绘制行 plot3(tras(1), tras(2), tras(3), 'bo');

    p = [   0.0,    0.0,    0.0
          500.0,    0.0,    0.0
          500.0, -500.0,    0.0
            0.0, -500.0,    0.0
            0.0,    0.0,    0.0];
    mano = [119.818542 -43.371277 50.230591 1];

Tinv = [
 0.998891 -0.001007 0.047065 64.223625
 0.000000 0.999771 0.021382 -291.750854
 -0.047076 -0.021359 0.998663 -1871.334229
 0.000000 0.000000 0.000000 1.000000
]

tras = Tinv*mano'

hold("on");
xlabel("X");
ylabel("Y");
zlabel("Z");

plot3(p(:,1), p(:,2), p(:,3), 'r*-');
plot3(tras(1), tras(2), tras(3), 'bo');

hold("off");
pause;

I'm working in octave, I need to call plot3 two or more times to produce one graph. But it only plots the last call of plot3. I need some help.

This is my code:
It only plots the line plot3(tras(1), tras(2), tras(3), 'bo');

    p = [   0.0,    0.0,    0.0
          500.0,    0.0,    0.0
          500.0, -500.0,    0.0
            0.0, -500.0,    0.0
            0.0,    0.0,    0.0];
    mano = [119.818542 -43.371277 50.230591 1];

Tinv = [
 0.998891 -0.001007 0.047065 64.223625
 0.000000 0.999771 0.021382 -291.750854
 -0.047076 -0.021359 0.998663 -1871.334229
 0.000000 0.000000 0.000000 1.000000
]

tras = Tinv*mano'

hold("on");
xlabel("X");
ylabel("Y");
zlabel("Z");

plot3(p(:,1), p(:,2), p(:,3), 'r*-');
plot3(tras(1), tras(2), tras(3), 'bo');

hold("off");
pause;

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

年华零落成诗 2024-12-28 09:35:45

你的绘图代码没问题。尝试使用 axis 函数增大绘图范围。以下更改:

% ...

% Usage of axis: axis([xmin xmax ymin ymax zmin zmax])
axis([-100 600 -600 100 -2100 100]);
plot3(p(:,1), p(:,2), p(:,3), 'r*-');
plot3(tras(1), tras(2), tras(3), 'bo');    

% ...

导致下图:
在此处输入图像描述

理想情况下,您可以使 axis 中的范围值相对于最小值和ptras 中的最大坐标值。

Your plotting code is fine. Try making the plot extents larger with the axis function. The following change:

% ...

% Usage of axis: axis([xmin xmax ymin ymax zmin zmax])
axis([-100 600 -600 100 -2100 100]);
plot3(p(:,1), p(:,2), p(:,3), 'r*-');
plot3(tras(1), tras(2), tras(3), 'bo');    

% ...

Results in the following plot:
enter image description here

Ideally, you would make the extents values in axis relative to the minimum and maximum coordinate values in p and tras.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文