Get Help

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- Best Smoothing Approach

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

03-25-2021
11:47 PM

03-25-2021
11:47 PM

Hi

Help with smoothing function please.

I am having issues formulation a smoothing function. Errors like "This value must be a vector of real numbers: pop up.

A working example will help a lot.

Prime 6 File Attached.

Solved! Go to Solution.

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

03-28-2021
05:51 PM

03-28-2021
05:51 PM

l having problems plotting.

Mathcad and Excel file attached for your help please.

12 REPLIES 12

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

03-26-2021
01:40 AM

03-26-2021
01:40 AM

Re: Best Smoothing Approach

Your approach failed because i is not a vector but a range!

In the pic below I used an undocumented trick to turn a range into a vector by adding a numeric evaluation when defining the variable i. Furthermore I chose the first value to be 1 instead of zero so the magnitude of i and r.dom match.

But of course you are on the save side if you define the necessary vector the "legal" way:

A working example can also be found in the help

You may also be interested in the information about smoothing in the MC15 help. Find it converted to pdf in the attachments.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

03-26-2021
03:00 PM

03-26-2021
03:00 PM

Re: Best Smoothing Approach

Is it possible to integrate the supsmooth function?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

03-26-2021
03:48 PM

03-26-2021
03:48 PM

Re: Best Smoothing Approach

@DJF wrote:

Is it possible to integrate the supsmooth function?

supsmooth does not return a function but rather a vector of y-values corresponding to the vector of x-values provided.

You either can write your own "integration" function which works on datapoints given by vectors or you use interpolation (either linear or cubic splines) to turn the result of supsmooth into a function.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

03-26-2021
04:25 PM

03-26-2021
04:25 PM

Re: Best Smoothing Approach

A function for the supsmooth can be defined using the x and y vectors with interp function. This new function can be integrated.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

03-26-2021
05:13 PM

03-26-2021
05:13 PM

Re: Best Smoothing Approach

I see. So, then no real advantage to using supsmooth over say a b-spline (unless you happen to like the fit better). was hoping to save a step. Thanks all.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

03-28-2021
05:51 PM

03-28-2021
05:51 PM

l having problems plotting.

Mathcad and Excel file attached for your help please.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

03-29-2021
07:05 AM

03-29-2021
07:05 AM

Re: Best Smoothing Approach

What's the problem...it plots

doesn't it?

Luc

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

03-29-2021
07:51 AM

03-29-2021
07:51 AM

Re: Best Smoothing Approach

Sorry wasn’t clear. Can’t plot the smoothed data.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

03-29-2021
09:08 PM

03-29-2021
09:08 PM

Re: Best Smoothing Approach

I don't see any attempt to plot r.smooth ??

Maybe you just have to move down the plot below the definition of r.smooth?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

03-29-2021
09:15 PM

03-29-2021
09:15 PM

Re: Best Smoothing Approach

Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

03-30-2021
05:19 AM

03-30-2021
05:19 AM

Re: Best Smoothing Approach

An additional remark:

It looks like you got confused by the indexing of vectors. By default Prime starts with zero.

You defined your range i starting from 1 and then plotted Loc[i over i. That way your plot gets shifted to the left for 1 unit - the first value of your data vector "Loc" is ignored and the second one (index 1) is assigned to 1, etc.

Correct plot should look that way:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

03-30-2021
05:34 AM

03-30-2021
05:34 AM

Re: Best Smoothing Approach

Thanks for spotting that.