Turn on suggestions

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

Showing results for

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

Ulas

Member

04-16-2021 07:00 AM

Options

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

Hi am trying to linear Fit a XY graph.

The inputs of the XY graph are the Y components of two waveforms. When the two waveforms are plotted against eachother i should see a linear fit, and i do (see picture).

I am trying to linear fit the XY graph by using the linear fit.vi. When doing so the output of the linear fit is an empty array (see probes). My input data into the linear are of the same length so i dont understand what i am doing wrong.

Solved! Go to Solution.

Download All

Virus scan in progress. Please wait to download attachments.

GerdW

Knight of NI

04-16-2021 07:07 AM

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

Hi Ulas,

two suggestions:

- check the error output of the LinearFit function
- attach your VI with some example data embedded when you want more help!

Best regards,

GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO

GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO

RavensFan

Knight of NI

04-16-2021 07:20 AM

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

Are your X arrays and Y arrays the same length?

04-16-2021 07:28 AM

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

The error message i receive is

−20068 | Input parameters has at least one element that is Inf, NaN, DBL_MAX, or DBL_MIN |

The reason why i hadnt added the VI is because it is large, however i have added it to this message.

04-16-2021 07:29 AM

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

Yes they are both 1971 elements long

Solution

Accepted by Ulas

Kyle97330

Active Participant

04-16-2021 11:43 AM

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

You're running your data through a normalize, then you normalize it to between 0 and 1 with some math, then run it through a log function before the linear fit.

This means that you're guaranteed at least one zero value pre-log, and ln(0) produces an illegal value, which is the cause of the error you stated.

04-19-2021 03:25 AM

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

Thank you this was actually a really easy solution. Should have been able to think of it myself.

Thank you for the help