Curve smoothing
-
- Aurora
- Posts: 888
- Joined: Mon Nov 24, 2014 2:03 pm
Curve smoothing
Hi Folks,
In my UFO_bas progam I used curve-smoothing code written in the late '80s. Interpolating curves is still a major maths research subject.
The original code was written for tracing contours on maps. A statistician asked me if it could be used with financial data ? Yes...!
The Demo has had one or two quirks improved, but I am still working to remove one case which causes 'sharp' points.
They are easy to trap, but not yet resolved completely. But the result is still better than most 'Bezier Spline' routines.
Curve precision can be ajusted on line 140 (prec=4 to 40). See its effects with dotss=4 on line 130 !
The code is long but fast, since the program steps far between the many conditional blocks, depending on how dots are positioned !
In my UFO_bas progam I used curve-smoothing code written in the late '80s. Interpolating curves is still a major maths research subject.
The original code was written for tracing contours on maps. A statistician asked me if it could be used with financial data ? Yes...!
The Demo has had one or two quirks improved, but I am still working to remove one case which causes 'sharp' points.
They are easy to trap, but not yet resolved completely. But the result is still better than most 'Bezier Spline' routines.
Curve precision can be ajusted on line 140 (prec=4 to 40). See its effects with dotss=4 on line 130 !
The code is long but fast, since the program steps far between the many conditional blocks, depending on how dots are positioned !
-
- Aurora
- Posts: 888
- Joined: Mon Nov 24, 2014 2:03 pm
Re: Curve smoothing
Hi Folks,
Curve smoothing has many applications, including statistics, encryption and decompression of waveforms, etc.
This program version eliminates former 'sharpish' apexes and straight lines, and caters for the terminating end-points.
A final version will allow you to load in your own data, (which is randomly generated for this demo).
Just UNZIP and LRUN or hit 'n' to repeat the paused output. You can alter the number of dots and the precision : see top of listing.
Have started fully commenting the code in REMarks, as there is a lot of it, mostly written in the late eighties. Regards, Steve.
Curve smoothing has many applications, including statistics, encryption and decompression of waveforms, etc.
This program version eliminates former 'sharpish' apexes and straight lines, and caters for the terminating end-points.
A final version will allow you to load in your own data, (which is randomly generated for this demo).
Just UNZIP and LRUN or hit 'n' to repeat the paused output. You can alter the number of dots and the precision : see top of listing.
Have started fully commenting the code in REMarks, as there is a lot of it, mostly written in the late eighties. Regards, Steve.
-
- QL Wafer Drive
- Posts: 1066
- Joined: Sat Oct 25, 2014 9:53 am
-
- Aurora
- Posts: 888
- Joined: Mon Nov 24, 2014 2:03 pm
Re: Curve smoothing
Hi Cristian,
This error may be a name-table problem. What system are you using ?
The program has run for a week under QPC2, with randomised data, tested ok... Steve.
__________________
This error may be a name-table problem. What system are you using ?
The program has run for a week under QPC2, with randomised data, tested ok... Steve.
__________________
Re: Curve smoothing
Running it on QPC2 I get the error
At line 1310:3 assignment can only be to a variable or array element
That statement is qx = xc-xd, the only thing I can think of is that QX is a clashing command name in a QLiberator toolkit extension?
Certainly, if I run t on a "clean" QPC2 (i.e. no extensions loaded), it works OK.
At line 1310:3 assignment can only be to a variable or array element
That statement is qx = xc-xd, the only thing I can think of is that QX is a clashing command name in a QLiberator toolkit extension?
Certainly, if I run t on a "clean" QPC2 (i.e. no extensions loaded), it works OK.
--
All things QL - https://dilwyn.theqlforum.com
All things QL - https://dilwyn.theqlforum.com
-
- Aurora
- Posts: 888
- Joined: Mon Nov 24, 2014 2:03 pm
Re: Curve smoothing
Hi Dilwyn,
Thanks for the feedback. Try changing the variable 'qx' to 'xq' on line 1310, and three times on line 1330. That should do it ?
_________________
Thanks for the feedback. Try changing the variable 'qx' to 'xq' on line 1310, and three times on line 1330. That should do it ?
_________________
-
- Aurora
- Posts: 888
- Joined: Mon Nov 24, 2014 2:03 pm
Re: Curve smoothing
Hi Cristian,
The error on your system stems from the variables 'ax' and 'ay' not being initialised : (Not a problem under QPC2).
Insert the following code : < 685 ax=t(a,x) : ay=t(a,y) > and all should be well....
When any more compatibility bugs are notified, I will issue a fixed version. Thanks for the feedback, Steve.
_________________
The error on your system stems from the variables 'ax' and 'ay' not being initialised : (Not a problem under QPC2).
Insert the following code : < 685 ax=t(a,x) : ay=t(a,y) > and all should be well....
When any more compatibility bugs are notified, I will issue a fixed version. Thanks for the feedback, Steve.
_________________