Dim xn As Single, xk As Single, x As Single, y As Single, n As _
Integer, h As Double, st As String, i As Integer
Worksheets("1").Activate
xn = Range("A2").Value
xk = Range("B2").Value
n = Range("C2").Value
h = (xk - xn) / n
i = 5 , Excel
For x = xn To xk Step h
y = (Sin(x) - 2.7) / (Abs(x) + Sqr(x ^ 4 + 1))
Cells(i, 1).NumberFormat = "0.00"
Cells(i, 1).Value = x
Cells(i, 2).Value = y
i = i + 1
Next x
End Sub
. 1.3.
1.3
3
1_3_1 , . 1.4.
1.4 1_3_1
:
() | ||
UserForm1 | Name | 1_3_1 |
Caption | ||
Label1 | Caption | x= |
Font(; ) | ; 10 | |
Label2 | Caption | ʳ x= |
Font(; ) | ; 10 | |
Label3 | Caption | ʳ n= |
Font(; ) | ; 10 | |
Label4 | Caption | |
Font(; ) | ; 10 | |
TextBox1 | Name | xn |
Font(; ) | ; 10 | |
TextBox2 | Name | xk |
Font(; ) | ; 10 | |
TextBox3 | Name | n |
Font(; ) | ; 10 | |
TextBox4 | Name | xy |
Font(; ) | ; 10 | |
MultiLine | True | |
ScrollBars | ||
CommandButton1 | Caption | |
Font(; ) | ; 12 |
:
Private Sub CommandButton1_Click()
Dim xn As Single, xk As Single, x As Single, y As Single, n As _
Integer, h As Double, st As String
xy.Text = ""
xn = xnv.Text
xk = xkv.Text
n = nv.Text
h = (xk - xn) / n
For x = xn To xk Step h
y = (Sin(x) - 2.7) / (Abs(x) + Sqr(x ^ 4 + 1))
xy.Text = xy.Text & "x=" & x & vbTab & "y=" & y & vbCrLf
Next x
End Sub
. 1.5.
1.5
1.3.2 x, . S:
1) ;
2) .
: , , .
.
1
, n S 2 EXCEL B2, B1, B4, . 1.6.
CommandButton1, OptionButton1, OptionButton2, 1.
|
|
1.6 2
, 2:
() | ||
OptionButton1 | Caption | |
Font(; ) | ; 10 | |
OptionButton2 | Caption | n=10 |
Font(; ) | ; 10 | |
CommandButton1 | Caption | |
Font(; ) | ; 12 |
: