首页 > 解决方案 > 在 Julia 中绘制函数

问题描述

我正在尝试在 Julia 中绘制一个函数,但不断出现错误。我不明白出了什么问题。$\varphi$ 的输入和输出是一个标量。我用过x=1530:1545,还是报错——谁能赐教?我很困扰。

我正在使用 Julia 0.7。在此处输入图像描述

编辑:

我稍作修改就可以使用它-我更改 x = 1530:1545 了添加以下两行

y = t.(x) plot(x,y)

为什么我必须这样做?

标签: julia

解决方案


此功能目前在 中不可用PyPlots.jl,如果您以后想拥有它,最好的办法是提交问题。但是,您可以通过Plots.jl并将PyPlot其用作后端来获得该功能。它看起来像这样(我将采用一个更简单的函数):

using Plots
pyplot()

start_point = 0
end_point = 10
plot_range = start_point:end_point
plot(sqrt,plot_range) # if you want the function exactly at 0,1,2,3...
plot(plot_range,sqrt) # works the same
plot(sqrt,start_point,end_point) # automatically chooses the interior points

推荐阅读