首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VBA >

怎么根据函数在excel中画曲线

2012-02-08 
如何根据函数在excel中画曲线我想根据一个函数画一系列曲线,请大家帮忙指点!函数:Yconst*X/(1-X+const*X)

如何根据函数在excel中画曲线
我想根据一个函数画一系列曲线,请大家帮忙指点!
函数:Y=const*X/(1-X+const*X)
const为0.6,0.7,0.8,0.9类似的可选定值,通过const计算出Y于X的关系!
谢谢!

[解决办法]

VB code
'Y=const*X/(1-X+const*X)0.6,0.7,0.8,0.9Sub draw()    Dim X As Double, Y As Double    Const c As Double = 0.6    Dim rng As Range, i As Integer, j As Integer        Set rng = Range("A1")    rng.Offset(1, 0).Value = 0.6    rng.Offset(2, 0).Value = 0.7    rng.Offset(3, 0).Value = 0.8    rng.Offset(4, 0).Value = 0.9        For i = 1 To 20        rng.Offset(0, i).Value = 1 - i * 0.1        For j = 1 To 4            rng.Offset(j, i).Formula = _            "=" & rng.Offset(j, 0) & " * " & rng.Offset(0, i) & _            " / (1 - " & rng.Offset(0, i) & _            " + " & rng.Offset(j, 0) & _            " * " & rng.Offset(0, i) & ")"        Next j    Next i        Dim obj As Variant    ActiveSheet.ChartObjects("Graph1").Delete    Set obj = ActiveSheet.ChartObjects.add(Left:=18, Top:=72.5, Width:=675, Height:=340)    obj.Name = "Graph1"    obj.Chart.SetSourceData Source:=Range("A1:U5"), PlotBy:=xlRows    obj.Activate        For i = 1 To 4        ActiveChart.SeriesCollection(i).ChartType = xlLineMarkers    Next i    End Sub
[解决办法]
看看~~~~~~

热点排行