'Das würde schon reichen:
Function Plot()
Dim i As Double, y As Double
For x = -10 To 10 Step 0.1
y = Range("M13") * x ^ 3 + Range("O13") * x ^ 2 + Range("Q13") * x + Range("S13")
i=i+1
cells(i,1)=x
cells(i,2)=y
Next x
End Function
'So läuft es um Einiges schneller... (Zelleninhalte in Variablen Speichern > Ergebnisse in Array speichern >
'Daten auf einen Schlag im Arbeitsblatt speichern)
Function Plot()
Dim i As Double, y(1 To 201, 1 To 2) As Double, a#, b#, c#, x#
a = Range("M13").Value
b = Range("O13").Value
c = Range("S13").Value
For x = -10 To 10 Step 0.1
i = i + 1
y(i, 2) = a * x ^ 3 + b * x ^ 2 + b * x + c
y(i, 1) = x
Next x
Range(Cells(1, 1), Cells(UBound(y), UBound(y, 2))).Value = y
End Function
|