473,569 Members | 3,035 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Interpolate data from tabel

Hi.

I need to interpolate som data i have in my tabel.
my tabel looks like this.
Y X
0
0 0,026
0,037
0,003 0,038
0,005 0,064
0,067
0,074
0,008 0,077
0,01 0,09
0,093

but i need a smart way to interpolate the emty places in Y.
i did make som code in vba, but it takes about 3 min for 1100
recordset, and its to slow, there for im asking for some help with som
codes .
hope somone can help :(
thanks

Jan 5 '06 #1
15 2608
This is old. Maybe it will help. Maybe not.

Dim m As Currency, b As Currency
Sub sInterpolation( )
Dim strSQL As String
Call sRegressionLine
strSQL = "UPDATE Data SET Data.Y = " & _
"(" & m & ")" & " * [X] + (" & b & ")" & _
"WHERE (((Data.Y) Is Null) AND ((Data.X) Is Not Null));"
CurrentDb.Execu te strSQL
End Sub
Sub sRegressionLine ()
Dim dbs As Database, rcs As Recordset
Set dbs = CurrentDb()
Set rcs = dbs.OpenRecords et("SELECT Sum(Data.X) AS SumX, " & _
"Sum([X]*[X]) AS SumXX, Sum(Data.Y) AS SumY, Sum([X]*[Y]) AS SumXY,
" & _
"Count(Data .X) AS N FROM Data " & _
"WHERE (((Data.X) Is Not Null) AND ((Data.Y) Is Not Null));")
m = (rcs!N * rcs!SumXY - rcs!SumX * rcs!SumY) / (rcs!N * rcs!SumXX
- rcs!
SumX ^ 2)
b = (rcs!SumY * rcs!SumXX - rcs!SumX * rcs!SumXY) / (rcs!N *
rcs!SumXX -
rcs!SumX ^ 2)
End Sub

Jan 5 '06 #2
the compiler says that there is a syntaxt error on
strSQL = "UPDATE Data SET Data.Y = (" & m & ")" & " * [X] + (" & b
& ") " & _
" WHERE (((Data.Y) Is Null) AND ((Data.X) Is Not Null));"

need ,

Jan 5 '06 #3
the code sems very nice, but i cant get´it work on vba (access)

Jan 5 '06 #4
For it to compile one would need to remove any usenet client created
line breaks.

For instance this
"Sum([X]*[X]) AS SumXX, Sum(Data.Y) AS SumY, Sum([X]*[Y]) AS SumXY," &
_
should be all one line but my/your usenet client may have cut it into
"Sum([X]*[X]) AS SumXX, Sum(Data.Y) AS SumY, Sum([X]*[Y]) AS
SumXY,
" & _

To get it "to work" one would have to have a Table called Data with
fields called X etc, or one would have to substitute table names and
field names of his own table and fields for these.

Jan 5 '06 #5
hi again,....
i Did renamed my tabel as Data and both my attribut as X and Y.
and its also possible for me to see the number inside the variabels.

Jan 5 '06 #6
I'm sorry; I'm not there and I can't tell what might be wrong.

Jan 5 '06 #7
did try the code, before you post it here ?

Jan 5 '06 #8
did try the code, before you post it here ?

Jan 5 '06 #9
did try the code, before you post it here ?

Jan 5 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3832
by: Alex | last post by:
Hi, I need to perform cubic spline interpolation of a dataset. I am using scipy. When I pass two arrays (x,y) to the interpolate.splrep(x,y) function I get the following traceback Traceback (most recent call last): File "./optmat.py", line 138, in ? initspline = interpol.getspline(initkeys,inittable) File "./optmat.py", line 77, in...
1
4426
by: Nothing | last post by:
I received a db2 data file that I converted to MS-Access. From Access I ran the upsize wizard to put the tabel in SQL. It put the table in ok but all the data types are nvarchar. I have a couple of the fields that are cureny and some that are numeric. I need to change the data types from nvarchar to numeric type fields. I am new to SQL so I...
4
1587
by: Roland Wolters | last post by:
Hi, I am reading data from a unix odbc datasource in a c# program. Reading the data as works fine, but one field, contains a date-time format that .net does not understand. The query would be: "Select birthdate from <tabel> where bla bla" We use an odbc command object, and an odbcdatareader.
9
1499
by: elia | last post by:
Hello, I would like to show a line in a tabel in html if there is quantity of article choosed. My code is: <? if ($quantite1 0) { echo(' <tr>
4
4396
by: sanparab | last post by:
I am a new user for MS Access 2003, I want to transfer a data of Fixed lenght text file into Access Tabel. The data is contained of four Record Set those are as follows 1. The header record type is ‘H’. 2. The detail record type is ‘D’. 3. The summary record type is ‘S’. 4. “END OF DOCUMENT” record is left justified with no record...
7
1839
by: Kristiansj | last post by:
Hey, I am a fairly novice coder and I am having some trouble making an elegant solution to the following problem: (pseudocode) ------------ switch (something) { case (something1) tabel = tabel_1 case (something2) tabel = tabel_2 etc....
0
1513
by: Steve Kirby | last post by:
You can't ... What you might try is: desc tabe1 This will list the columns in that table. You can select what you want to pull from that way.
1
1146
by: arunbojan | last post by:
Dear All, Please advice me some tips in ASP.NET to make tabel attractive..... Arun
1
1783
by: tradevol | last post by:
Hi, I have a client app which directly read the byte stream from the socket, which is sent from linux 64 bit server app. One problem I have is that I realize that it seems like the minimum size for the data sent from linux is 4 bytes. even though the server only sent one char. Any short type data is 8 bytes also (instead of 2 bytes as...
0
7703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8138
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7681
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6290
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5228
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2118
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1229
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
950
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.