2017-11-04 145 views
1

我是Wolfram Mathematica的新手,我對Mathematica中的plottin斜坡場感到絕望。 微分方程是y'=y-x²,我想繪製其在|x| <= 3, -1 <= y <= 4區域的斜率字段,將斜率字段的長度縮放爲1.我發現我可以使用VectorPlot函數執行此操作,但我無法完成此操作我自己一個人。有人可以告訴我如何做到這一點?如何使用VectorPlot繪製Mathematica中微分方程y'= y-x²的斜率場?

編輯:這是正確的:VectorPlot[{1, y[x] - x^2}, {x, -3, 3}, {y[x], -1, 4}]

+0

'VectorPoints'不是一個函數,它的一個選項,以'VectorPlot'這並不似乎有什麼與你的問題。也許在任何情況下都要問mathematica.stackexchange.com。 – agentp

+0

你說得對,這是我的一個錯誤。我的意思是'VectorPlot'。 –

+0

如果您使用'y'而不是'y [x]'(兩個地方),那麼這將在語法上正確。它不完全清楚你爲什麼要將矢量圖繪製爲標量。 – agentp

回答

2
VectorPlot[{1, y - x^2}, {x, -3, 3}, {y, -1, 4}, 
Frame -> False, Axes -> True, StreamPoints -> 20] 

enter image description here

+0

好吧,我不得不承認,這看起來好多了。謝謝你。 –

相關問題