如何在 MATLAB 中绘制基本线图?

发布于 2024-08-10 23:20:34 字数 570 浏览 0 评论 0原文

我有

a =

   54.1848
   50.0456
   99.9748
   83.1009
   63.1457
   91.7577
   64.0805
   48.2090
   75.7711

t =

   79.7077
   31.0913
   14.9389
   10.8303
   16.4844
   26.8465
   41.6946
   77.3369
  186.3246

如何在y轴上使用a和在x轴上使用t制作简单的线图?

plot (a,t) 给出

alt text

plot (t,a) 给出

alt text

我不明白它们是如何生成的。结果应该是别的东西。

I have

a =

   54.1848
   50.0456
   99.9748
   83.1009
   63.1457
   91.7577
   64.0805
   48.2090
   75.7711

t =

   79.7077
   31.0913
   14.9389
   10.8303
   16.4844
   26.8465
   41.6946
   77.3369
  186.3246

How can make a simple line plot with a on y axis and t on x axis?

plot (a,t) gives

alt text

and plot (t,a) gives

alt text

I don't understand how these are generated. The result should be something else.

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

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

发布评论

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

评论(2

反话 2024-08-17 23:20:34
[t_sorted, index] = sort(t);
plot(t_sorted, a(index));

是最有效的方法。

或者,如果您真的不喜欢这些行,您可以简单地使用:

plot(t,a,'rx')
[t_sorted, index] = sort(t);
plot(t_sorted, a(index));

is the most efficient way to do this.

Or, if you don't really care for having the lines you can simply use:

plot(t,a,'rx')
若水般的淡然安静女子 2024-08-17 23:20:34

我认为,如果您根据 t 中的值对两个向量进行排序,然后使用 plot(t,a) 您将得到您想要的。

I think that if you sort both vectors according to the values in t and then use plot(t,a) you will get what you want.

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