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

SOLVED
Highlighted

## Regression of a trigonometric function or of an exponential function

Hi,

is it possible to do a regression as simple as in a graphing calculator?

There I have got a statistic menu where i can write down my x and y values. Then I hit the [Reg]ression button and the [sin]us button. Done.

I tried to solve my problem in MathCad with 2 vectors and the sinfit function, but it does not work 😕

There is the same problem with an exponential function...

There I used expfit, where it said the "guessing"-vector is optional, so I left it out. -> No solution...

Can u help me??

Thank You.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

## Re: Regression of a trigonometric function or of an exponential function

Mathcad's sinfit function is essentially useless. There is no multiplier for x, and that multiplier changes the frequency of the sin wave. Whoever originally implemented this function, with no ability to vary the frequency, must have been mentally deficient!

Here's a generic approach to fitting. You can use this to fit any function, not just the few built-in ones.

10 REPLIES 10
Highlighted

## Re: Regression of a trigonometric function or of an exponential function

Can you post a worksheet of the problem?

Mike

Highlighted

## Re: Regression of a trigonometric function or of an exponential function

It's a task from my schoolbook.

t is the time in hours

dm is the current flow rate of a tidal power station in (m^3)/h

In the second graph you can see, that the regression results of my graphing calculator ar better than the results of mathcad...

Highlighted

## Re: Regression of a trigonometric function or of an exponential function

Mathcad's sinfit function is essentially useless. There is no multiplier for x, and that multiplier changes the frequency of the sin wave. Whoever originally implemented this function, with no ability to vary the frequency, must have been mentally deficient!

Here's a generic approach to fitting. You can use this to fit any function, not just the few built-in ones.

Highlighted

## Re: Regression of a trigonometric function or of an exponential function

It's not that easy but thanks a lot!

Now I just have to read the manual or the help file to understand what you did Highlighted

## Re: Regression of a trigonometric function or of an exponential function

 It's not that easy

True, but it is very flexible. You can use this approach to fit any function to your data, not just a few built-in functions.

Highlighted

## Re: Regression of a trigonometric function or of an exponential function

Superb function Richard.

I spent a lot of time trying to solve this last night with no success and never came across that function. Did you create it?

Mike

Highlighted

## Re: Regression of a trigonometric function or of an exponential function

 Superb function Richard.

I'm confused. Which function?

Highlighted

## Re: Regression of a trigonometric function or of an exponential function

 I'm confused. Which function?

The fitting function. I know you have only used Minerr, but the way it is implemented is impressive.

Mike

Highlighted

## Re: Regression of a trigonometric function or of an exponential function

It's standard stuff. There are hundreds (literally!) of examples of how to use minerr this way that have been posted over the years. It is not something I dreamt up on my own.

Highlighted

## Re: Regression of a trigonometric function or of an exponential function

 It's standard stuff. There are hundreds (literally!) of examples of how to use minerr this way that have been posted over the years. It is not something I dreamt up on my own.

It's standard now because I have seen it, but it's not standard until someone posts an example. On this occasion the person was you, thus my gratitude heading your way. Mike