cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

Need a little help with polynomial regression fitting in Mathcad 15

regcurry
16-Pearl

Need a little help with polynomial regression fitting in Mathcad 15

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

 

Reg
ACCEPTED SOLUTION

Accepted Solutions
LucMeekes
23-Emerald III
(To:regcurry)

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

View solution in original post

10 REPLIES 10

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

Reg

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

Reg
LucMeekes
23-Emerald III
(To:regcurry)

Your PPD function could be:

LucMeekes_0-1711874765800.png

 

Success!
Luc

👍

Reg

This looks better, but how do I get the reverse arrow in Mathcad 15?

Reg

This is where I am.  Do I need a and b to get MAX?  I don't find MAX as a function in 15.  You clearly are way above me on Mathcad.

regcurry_0-1711916589174.png

 

Reg
LucMeekes
23-Emerald III
(To:regcurry)

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

Thanks again. I hope to get this working so I don’t have to call the subroutine. I don’t follow all the logic yet, but it looks much better than the subroutine.

Again, you are a real help.
Reg Curry @Comcast 🖥
Reg

regcurry_0-1711931072241.png

This is great.  Now I need to understand the logic.  Is there a list of keystroke substitutes for Mathcad 13?  I found it in the built-in help file under keystroke>local Assignment Operator in A Program and in the program dialog box.

 

I've been using Mathcad since about 1980 and I still have a lot to learn.  I'm 81, so I don't think I will get everything.

This is a great resource.

LucMeekes, thanks so much.  I really appreciate your helpfulness and patience.

Reg Curry

Reg
ttokoro
20-Turquoise
(To:regcurry)

d=8, N=8.

image.pngimage.pngimage.png

Announcements

Top Tags