Home > Software engineering >  For help again.. Vb quadratic curve fitting and drawing how to do? Code for research
For help again.. Vb quadratic curve fitting and drawing how to do? Code for research

Time:09-30

Functional requirements is

Input 5 to 6 groups of experimental data (x, y)

Want to synthesis of quadratic function y=ax ^ 2 + bx + c
in the form of
The algorithm of least square best

Can and draw graphics (the origin of the coordinate variable, not necessarily is 0, 0)

To master the code to the

Thank you very much

CodePudding user response:

http://www.baigoogledu.com/s.php? Hl=useful - CN& Q=B6 % % % % % FE B4 CE C7 E2 C4 DF CF FA % % % % % % BA + B4 D4 VB6 % % % % CF B4 C2 FA % % % EB

CodePudding user response:

reference 1st floor zhao4zhong1 response:
http://www.baigoogledu.com/s.php? Hl=useful - CN& Q=B6 % % % % % FE B4 CE C7 E2 C4 DF CF FA % % % % % % BA + B4 D4 VB6 % % % % CF B4 C2 FA % % % EB


May explain this code, please, I want what to do of input data interface, which correspond to the parameters,,


Public Sub qxnh2 () 'least squares curve fitting y=a + bx + cx ^ 2
Dim b, c, m, n, a (1 To 10, 1 To 10) As a Double
Dim I, j, k, d (10) As a Double
'm=14' 9 'm number for the data
For I=1 To 10 Step 1
D (I)=0
Next I
For I=1 To m Step 1
D (1)=d (1) + x (I)
A (1, 2)=d (1)
D (2)=d (2) + x (I) ^ 2
A (1, 3)=d (2)
D (3)=d (3) + y (I)
A (1, 4)=d (3)
D (4)=d (4) + x (I) ^ 3
A (2, 3)=d (4)
D (5)=d (5) + x (I) * y (I)
A (2, 4)=d (5)
D (6)=d (6) + x (I) ^ 4
A (3, 3)=d (6)
D (7)=d (7) + x (I) ^ 2 * y (I)
A (3, 4)=d (7)
Next I
A (1, 1)=m
A (2, 1)=a (1, 2)
A (2, 2)=a (1, 3)
A (3, 1)=a (1, 3)
A (3, 2)=a (2, 3)
N=3 'n for the number of rows
M=4 'm is the number of columns
Step 1 For k=1 To n - 1
For I=k + 1 To n Step 1
For j=k + 1 To m Step 1
A (I, j)=a (I, j) - a (I, k) * a (k, j)/a (k, k)
Next j
Next I
Next k
Z (n)=a (n, m)/a (n, n)
For k=n - 1 To 1 Step - 1
Z (k)=0
For j=n + 1 Step To k - 1
Z=z (k) (k) + a (k, j) * z (j)
Next j
Z (k)=(a - z (k) (k, m))/a (k, k)
Next k
Z=xs (1) (1) : xs (2)=z (2) : xs (3)=z (3) : xs (4)=0
End Sub

CodePudding user response:

refer to the second floor angrycoco response:
Quote: refer to 1st floor zhao4zhong1 response:

http://www.baigoogledu.com/s.php? Hl=useful - CN& Q=B6 % % % % % FE B4 CE C7 E2 C4 DF CF FA % % % % % % BA + B4 D4 VB6 % % % % CF B4 C2 FA % % % EB


May explain this code, please, I want what to do of input data interface, which correspond to the parameters,,


Public Sub qxnh2 () 'least squares curve fitting y=a + bx + cx ^ 2
Dim b, c, m, n, a (1 To 10, 1 To 10) As a Double
Dim I, j, k, d (10) As a Double
'm=14' 9 'm number for the data
For I=1 To 10 Step 1
D (I)=0
Next I
For I=1 To m Step 1
D (1)=d (1) + x (I)
A (1, 2)=d (1)
D (2)=d (2) + x (I) ^ 2
A (1, 3)=d (2)
D (3)=d (3) + y (I)
A (1, 4)=d (3)
D (4)=d (4) + x (I) ^ 3
A (2, 3)=d (4)
D (5)=d (5) + x (I) * y (I)
A (2, 4)=d (5)
D (6)=d (6) + x (I) ^ 4
A (3, 3)=d (6)
D (7)=d (7) + x (I) ^ 2 * y (I)
A (3, 4)=d (7)
Next I
A (1, 1)=m
A (2, 1)=a (1, 2)
A (2, 2)=a (1, 3)
A (3, 1)=a (1, 3)
A (3, 2)=a (2, 3)
N=3 'n for the number of rows
M=4 'm is the number of columns
Step 1 For k=1 To n - 1
For I=k + 1 To n Step 1
For j=k + 1 To m Step 1
A (I, j)=a (I, j) - a (I, k) * a (k, j)/a (k, k)
Next j
Next I
Next k
Z (n)=a (n, m)/a (n, n)
For k=n - 1 To 1 Step - 1
Z (k)=0
For j=n + 1 Step To k - 1
Z=z (k) (k) + a (k, j) * z (j)
Next j
Z (k)=(a - z (k) (k, m))/a (k, k)
Next k
Z=xs (1) (1) : xs (2)=z (2) : xs (3)=z (3) : xs (4)=0
End Sub

This code, not the person to learn vb wrote

CodePudding user response:

reference zzyong00 reply: 3/f
Quote: refer to the second floor angrycoco response:

Quote: refer to 1st floor zhao4zhong1 response:

http://www.baigoogledu.com/s.php? Hl=useful - CN& Q=B6 % % % % % FE B4 CE C7 E2 C4 DF CF FA % % % % % % BA + B4 D4 VB6 % % % % CF B4 C2 FA % % % EB


May explain this code, please, I want what to do of input data interface, which correspond to the parameters,,


Public Sub qxnh2 () 'least squares curve fitting y=a + bx + cx ^ 2
Dim b, c, m, n, a (1 To 10, 1 To 10) As a Double
Dim I, j, k, d (10) As a Double
'm=14' 9 'm number for the data
For I=1 To 10 Step 1
D (I)=0
Next I
For I=1 To m Step 1
D (1)=d (1) + x (I)
A (1, 2)=d (1)
D (2)=d (2) + x (I) ^ 2
A (1, 3)=d (2)
D (3)=d (3) + y (I)
A (1, 4)=d (3)
D (4)=d (4) + x (I) ^ 3
A (2, 3)=d (4)
D (5)=d (5) + x (I) * y (I)
A (2, 4)=d (5)
D (6)=d (6) + x (I) ^ 4
A (3, 3)=d (6)
D (7)=d (7) + x (I) ^ 2 * y (I)
A (3, 4)=d (7)
Next I
A (1, 1)=m
A (2, 1)=a (1, 2)
A (2, 2)=a (1, 3)
A (3, 1)=a (1, 3)
A (3, 2)=a (2, 3)
N=3 'n for the number of rows
M=4 'm is the number of columns
Step 1 For k=1 To n - 1
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull