数学编程

时间:2017-04-12 03:47:40

标签: excel excel-vba programming-languages vba

我有一个具有特定功能的项目f(x)=Sin(x)。我的代码将提示用户输入x的上限和下限,以及n的间隔数。然后,代码会将x的固定值分配到一列中,将f(x)的值分配到另一列中。然后,它应该创建一个函数图。到目前为止,我有

Function y() 'function 1 on sheet 1'
    Dim a As Double
    Dim b As Double
    Dim n As Integer
    Dim X As Integer
    a = InputBox("Enter your value for a on the interval [a,b]")
    b = InputBox("Enter your value for b on the interval [a,b]")
    n = InputBox("Enter the number of intervals for the function")

    If (b <= a) Then
        b = InputBox("Enter a value for b that is greater than the value you entered for a")
    End If

    Do While (x >= a) Or (x <= b)
        y = Sin(x)
    Loop
End Function

我遇到的问题是创建列。我不知道如何使代码将固定值返回到一列,而将变量值返回到另一列。任何帮助,将不胜感激!

0 个答案:

没有答案