Forgot password
 Register account
View 938|Reply 2

为什么这两个的效果不一样?

[Copy link]

2

Threads

4

Posts

0

Reputation

Show all posts

热爱生命 posted 2018-9-9 17:12 |Read mode
Plot[Table[Sin[i x], {i, 1, 3}], {x, 0, Pi}]
Plot[{Sin[x], Sin[2 x], Sin[3 x]}, {x, 0, Pi}]
QQ截图20180909170859.png
这两个图画出来,一个是三个函数同样的颜色,另一个是三个函数三种颜色,这是为什么?用Table的话怎样调整才能变成三种颜色,试过PlotStyle是不行的。
我用的版本是11.1。

673

Threads

110K

Posts

218

Reputation

Show all posts

kuing posted 2018-9-9 17:17
我也不知道为什么,不过解决倒是简单,只要分开两步就行,即:
Table[Sin[i x], {i, 1, 3}];
Plot[%, {x, 0, Pi}]

2

Threads

4

Posts

0

Reputation

Show all posts

original poster 热爱生命 posted 2018-11-17 20:44
无意中发现改成Plot[Evaluate[Table[Sin[n x], {n, 1, 3}]], {x, 0, Pi}]就可以了,不过还是不知道是什么原理。

Quick Reply

Advanced Mode
B Color Image Link Quote Code Smilies
You have to log in before you can reply Login | Register account

$\LaTeX$ formula tutorial

Mobile version

2025-7-20 05:46 GMT+8

Powered by Discuz!

Processed in 0.013096 seconds, 25 queries