Skip to main content
16-Pearl
March 30, 2024
Solved

Need a little help with polynomial regression fitting in Mathcad 15

  • March 30, 2024
  • 3 replies
  • 3689 views

Background:

Although unimportant to my question, I am trying to resurrect a Filon Method of Fourier Transforms that I used over 30 years ago in a Fortran code (see my profile😕).  I am in the first steps, which require that I develop a polynomial fit to the function to be transformed.  Another function will not work in this method.

My quandaries:

Attached is a Mathcad 15 code for the first steps of this process.  You will also need the subroutine called; it is attached also.  I searched the PTC Community and found this reference:

https://community.ptc.com/t5/Mathcad/The-best-way-to-extract-polynomial-coefficients-and-form-an/m-p/345426#M135001

It states that the coefficients of the polynomial fit are the result of the regress(x,y,order) function.  However, that cannot be correct as I show in my worksheet. 

  1. Is this the difference between Mathcad 15 and Prime?  My Prime version is very old and and I not very experienced with it.
  2. If that is not the case, how do I get the actual coefficients of the polynomial fit?

Just FYI: The fit is not particularly good, but that is not my question now.  If I change the order to 16, it fits the exact expression better up to about 5x105 Hz, but with more oscillations around zero at the higher frequencies.  Again, not my question at this time, Also, FFTs do not work particularly well for such broadband signals over so many decades of time and frequency...the reason to desire a Filon method.

 

For some reason, I no longer get notified of replies.  I have not changed any settings.  So, I will check back for any replies.

 

Thanks much for any help.

Reg

 

Best answer by LucMeekes

You need the programmatic assignment operator (keystroke   {    ) to get the left-pointing arrow. Essentially it defines a local function MAX, as a specific instance of the built-in function max().

In Mathcad 11 and in Prime one can just use max as the third parameter to the matrix function. In Mathcad 14/15 that doesn't work.

(see my explanation of use of the matrix function here: https://community.ptc.com/t5/Mathcad/2D-Parametric-Geometry-with-Mathcad-Prime/m-p/939527#M210914 )

 

Success!
Luc

3 replies

regcurry16-PearlAuthor
16-Pearl
March 30, 2024

Forget any replies.  I figured it out by looking more carefully at a similar post.

regcurry16-PearlAuthor
16-Pearl
April 1, 2024

The accepted solution for this entire thread goes to LucMeekes!  I notified the monitor.  Sorry for my oversight.

23-Emerald IV
March 31, 2024

Your PPD function could be:

LucMeekes_0-1711874765800.png

 

Success!
Luc

regcurry16-PearlAuthor
16-Pearl
March 31, 2024

👍

ttokoro
21-Topaz I
21-Topaz I
April 1, 2024

d=8, N=8.

image.pngimage.pngimage.png

t.t.