Linear fit with chart buffer

I want to be able to graph both the data and the linear fit of the data stored in the chart buffer in real time.  I can't seem to figure out how to split the x and y arrays from the output on the chart buffer.  Any help would be appreciated.  I have attached a sample program.
Solved!
Go to Solution.
Attachments:
Graph Test.vi ‏10 KB

Heres one thing you could do:
Have your original data as two 1D arrays.
One is X values, and one is Y values.
Cluster those values together and that will be one data set.
Then, use the 'linear fit' function, and input your x and y arrays.
Use this new generated array of y-values and bundle them with the original array of x values.
If you build an array of the two data sets, then send them to an XY graph you should be all set.
Good luck :-)
Sorry I cant open your VI, Im in 8.2, not 8.6 :-(
Message Edited by Cory K on 02-16-2009 04:40 PM
Cory K
Attachments:
Linear Fit.PNG ‏5 KB

Similar Messages

  • Linear Fit not run with NaN

    Hi guys.
    I am trying use Linear Fit to made the best fit of temperature acquisition, but during the acquisition i acquire some NaN data.
    I can plot the temperature graph, but i cant plot or receivo soma data from Linear Fit.
    My code is below, in LV2010.
    Can anyone help me?
    Icaro Kossmann
    LabVIEW 8.6 Newbie.
    Brazil
    Solved!
    Go to Solution.
    Attachments:
    novo fit 16-04.vi ‏19 KB

    Follow my VI.
    Icaro Kossmann
    LabVIEW 8.6 Newbie.
    Brazil
    Attachments:
    Linear_fit_Teste,_array_constante_15-04-2014[1].vi ‏16 KB

  • Dynamic history size of xy chart buffer

    Hi all..
    My question is that when I wanna plot dynamic xy graph I should use xy chart. Till here everything is ok. But the option""history size"of xy chart buffer forces me to determine how many points of history data will be displayed. But  what i want is that not fixing it, i wanna see all measurement points till i stop the measurement. thats why i connected to history size option to loop number indicater so that after each measurement i would be able to see all the previos datas till i stop the loop. But it doesnt work!! Does my approach is wrong?

    Sima is right.
    You cannot have an unlimited history size on a computer with limited memory and resources (Yes, even gigabytes is not infinite). If course you can make your own history buffer by growing the x and y data in shift registers, but at one point during run the system will bog down due to constant memory reallocation operations. Also you cannot possible display more data that fits on a typical screen.
    Typically there is some knowledge on an upper boundary, so you can preallocate suitable buffers. If the history is bigger than fits in memory, stream to disk and add some mechansims to browse through history data by reading selected portions back.
    LabVIEW Champion . Do more with less code and in less time .

  • Bug in coefficien​ts output of General LS Linear Fit LabView 8.5.1?

    Hi
    I compiled my application from LabView 7.1.1 to LabView 8.5.1. This application use the "General LS Linear Fit.vi". I noticed that there differences in the calculation of the coefficients.
    There are attached two files, one comiled in LV7.1.1 and the other with LV 8.5.1, with two different results. Please make sure you open this files with the correct version.
    If I change in "General LS Linear Fit.vi" the link to the lvanlys.dll of the LV7.1.1 version, the calculations are correct.
    Any help would be appreciated, thanks.
    Fil

    Hi André
    I think the results in the 8.5 Version are completely wrong. If the result would deviate a few percent one could say that the new version could be more exact. But not like that.
    Fil
    Attachments:
    calc_71.JPG ‏154 KB
    calc_85.JPG ‏184 KB

  • Linear Fit using Bisquare method fails on certain data sets.

    I noticed some behavior that I didn't understand, so I thought I'd post it.  I'm using Linear Fit.vi in LabVIEW 8.2 to calculate a slope and offset.  This VI has a method input that accepts an enum.  When I select the "Bisquare" method on some data sets I get error -20104 (Analysis:  Input parameters have at least one NaN element).  I think that if some data sets don't work with certain algorithms, this should be mentioned in the help.  This took quite some time to track down.
    Here is an example of a data set that doesn't work with Linear Fit.
    X: Y:
    0.40336656 -4.04062388
    0.20171238 -2.01997989
    0.00072204 -0.00951483
    -0.20006598 1.99094268
    -0.39979904 3.99578023

    I can reproduce the problem.
    Interestingly, it works fine if you increase the tolerance input a little bit, e.g. to 0.0004 (from the default 0.0001). It also starts working if you change the data a little bit.
    Curious that it works on the Mac. There must be something pathalogical with this exact data set. Maybe it cause an unhandled division by zero in one of the iterations.
    LabVIEW Champion . Do more with less code and in less time .

  • How to create curve fitted line chart?

    Line chart is formed with straight lines, but how to create curve fitted line chart?

    Jasper wrote a blog on curve fitting charts

  • Linear fit between two cursors from a signal from a NI-instruments via DAQ-Assistant

    Hi ! 
    I'm currently having som problem with my labview code. I'm trying to make regression on a specific part of my graph. The graph consist of a signal gathered from a NI cDAQ-9178. Currently I can get the live data in a graph (Raw Signal) and then  "zoom in" to the part of the graph that im intrested in by two cursors and then display the results in a new graph (Adjusted Signal). Now a want to make regresion in the new graph. How can i do this the best way ? 
    To be noted I'm a beginner of labview so my code maybe a bit off.
    Best regards Maurlind
    Solved!
    Go to Solution.
    Attachments:
    Rawsignal test.vi ‏245 KB
    rawsignal test.png ‏64 KB

    Hi maurlind,
    I got it, the function that derived the linear fit couldn't handle that large numbers on the x-axis. I edited the VI so that the large number is suctracted for the fit, i.e. the array will now begin at zero time for the fit. It will not affect your plots though, only the algorithm .
    Try it now with the files I provided. The file "pm_mod2_Rawsignal test.vi" should be used with "test3.lvm" (your data). The file "pm_mod3_Rawsignal test.vi" is the same as "pm_mod2_Rawsignal test.vi", but it is arranged to work with the simulated data. The file "test3.lvm" is your data, but the file is slightly edited to work on my system.
    Edit "pm_mod3_Rawsignal test.vi" to fit with your acquired signal as you did with the first file you got from me.
    Attachments:
    1412794.zip ‏483 KB

  • Implementation of linear fit between two cursors

    Hi,
    I am trying to implement a linear fit between two cursors, as I am using total of 4 cursors. I would like to implement linear fit between cursor 2&3. Please help me how to implement it and to find a slope. I am also attaching my code.
    With Regards
    Phani kiran
    Solved!
    Go to Solution.
    Attachments:
    Linear Fit Implementaion.PNG ‏44 KB

    phanikiran wrote:
    Hi koen,
    Now I would like to merge both graphs i.e., Bestfit and XY Graph (in the block diagram). Can you suggest me, I have tried with build array and concenate Inputs function, but no use. Dont mine as I  am new to Labview. Thanks in advance.
    First, get rid of the Express XYGraph subVIs and use the "real" XY graph VIs. The Express ones get you going faster for simple things, but your options are limited.
    Take your X and Y arrays for both your original points and the best fit points (just two points, right?) and combine them into clusters of arrays (instead of feeding them into the XY graph). Then combine these into an array and feed it into your graph. It's all outlined in the XY Graph section of the LabVIEW help file.
    The LV Help File is your friend, learn to use it. It gets lonely if you don't look in on it once in a while.
    Cameron
    To err is human, but to really foul it up requires a computer.
    The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
    Profanity is the one language all programmers know best.
    An expert is someone who has made all the possible mistakes.
    To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):
    LabVIEW Unit 1 - Getting Started
    Learn to Use LabVIEW with MyDAQ

  • Bug sur la fonction "Linear Fit" entre LW 8.0 et LW 2009

    Bonjour,
    nous rencontrons des différences sur le résultat de la fonction LINEAR FIT.vi (avec méthode bisquare)
    Le même programme, un compilé sous LabVIEW 8.0 et l'autre sous LabVIEW 2009, donne des résultats différents. 
    Je ne trouve pas les corrections qui ont pu être apportées sur cette fonction entre les différentes versions de LabVIEW.
    Comment être certain que la fonction donne de bons résultats ? Celle sous LabVIEW 8.0 est-elle correcte ?
    Pour info, le résultat sous Lw 2014 est le même que sous LabVIEW 2009.
    Merci

    Sorry for the delay.
    I added two sreenshots with the same function and the same datas: the first example runs on LW8.0 and the 2nd runs on LW2014.
    We encounter differences on results (slope, interception ... etc)
    Thank you for your help 
    Attachments:
    RegLin_8.0.JPG ‏132 KB
    RegLin_2014.jpg ‏144 KB

  • Using Flex3 from Flex2 with chart building

    I just started playing with Flex 2 with Chart building. I got
    the paperwork to upgrade to Flex 3. What happens to the chart
    building component I bought with Flex 2. Is chart building built
    into Flex 3? Do I need to install that component?
    -icarus

    Arthanis wrote:Sorry, it´s because i didn´t know how to move the post, I saw that if fit in another part of the forum
    Don't worry too much.  I suppose I was being mean given you are new here. It is just that help tends to be better when clustered in one place. 
    jacko wrote:I thought about doing this for myself at some point, there is a lot of things I just do not need that is compiled in by default which I could rid myself of but, is all the time worth it in the end? Would like to hear someone elses expertise on this issue.
    Well, you could also add in more optimization for your specific processor.  But I honestly don't think you need this for every package.  Perhaps the kernel, glic and a couple of other often used and big packages, but in the end it is barely noticeable given Arch is fairly optimized by default and can make you system less stable.
    The only real reason to recompile is to add/remove options.  If the option is easy to add and doesn't bloat the package. the devs will probably add it for you if you ask in the bug tracker anyway.  I think the only package I now recompile are mozilla ones because I want the branding.

  • Weight values in weighted linear fit

    I am using Labview 8.5, which has the weighted linear fit vi. 
    What values are acceptable as weights? In other fitting software the weights expected are usually standard deviations of each value. It seems to me that the weights expected by the weighted linear fit vi are in a range from 0 to 1, corresponding to how much you value that point. 
    What is the vi actually looking for? Some value between 0 and 1 or the standard deviation for each particular value of the dependent variable? 
    I can't tell just by reading the help or looking online. 
    Solved!
    Go to Solution.

    Prior to LabVIEW 8.0, there was a "standard deviation" input instead of a weight input for the nonlinear fit function, but internally the code was basically the same (It was immediately converted to a weight internally).
    Weight is better and more convenient because you can completely disregard portions of the data by setting the weight to zero, while it would be weird trying to set the standard deviation to infinity to get the same effect (well, it would not work unless the function can detect that special case and adapt to it).
    Since it is mathematically very simple to translate an standard deviation into a weight, you can do that easily yourself.
    LabVIEW Champion . Do more with less code and in less time .

  • How to use linear fit

    Anyone here to help me how to use the linear fir vi?
    Is this vi capable of analyzing a line with a negative slope?
    What shold i input in this vi? I tried connecting my x and y arrays in this vi but still outputs nothing. Is there a bug on this vi?
    Is there a way to fit a line in my data points like what excel does?
    Thanks again for helping me numerous times.
    Brein
    Stuck again

    Brein wrote:
    This is my vi. I am using labview 7.0 and vision 7.0. This project is about finding a relationship between concentration of a certain solution and its color value using rgb space. I am already able to plot the relation ship found in sequence structure 3 of 3(assuming the first sequence is 0 of 3). How to put a linear fit in my data points?
    So you need to do a global fit to three datasets (R, G, & B). Since you seem to deal with a greyscale image, it is probably sufficient to fit only a single channel. What function do you use in excel?
    Sorry, I don't have the vision module. Can you strip down your VI as follows:
    create indicators on the three orange arrays in frame #2. (right-click wires, create indicator)
    Run the VI so the indicators contain data.
    Turn the indicators into diagram constants (right-click..change to constants). Wires will be broken, leave them broken!
    Save the VI under a new name and attach it again.
    I am quite busy today, maybe I can look at it tonight if nobody else gives a solution.
    LabVIEW Champion . Do more with less code and in less time .

  • 2D-Linear Fit needed

    Hello,
    I have to find the best straight line in a x-y measurement array.
    The "Linear Fit.vi" uses a linear regression method normal to the x-Axes which leads to bad results if the sollution would be near a vertical straight line.
    e.g.: with a Pair of measurement points with:
    1.: x=0 Y=+1
    2.: x=0 Y=-1
    I would like to get a straigth vertical line (x=0, k=inf or something which represents this), the Linear Fit.vi's result is NaN
    Does someone know where to find a vi for this?
    Thank you for any comments.
     Greetings
    Mario Hirth

    Mario Hirth wrote:
    Since I use the residuum of the linear fitting to evaluate the measurement (which should represent a straight line, but I dont know in which direction), I have to be mathematically correct.
    I also had a solution by iteration with: "find slope" => "turn measurement data into x-axis according to slope" => start again with finding slope => do this about 5 times etc...
    in principle this works, but since I have to make a iteration with the result of this output (which is a different story), I have a iterationtask  inside an iteration task.
    It works, but its neither a beatiful sollution nor a quick (means CPU-intensive).
    Mathematically, this makes no sense to me. Can you explain what it is supposed to achieve?
    What is the error in x and y for each data point?
    LabVIEW Champion . Do more with less code and in less time .

  • Weighted linear fit

    Hello,
    I'm new in this forum and unfortynately I'm not so confident with LabView.
    Now I'm working with LabView 7.1 and I have a normal linear fit in my program. What I would like to do is change this fitting with a weighted linear fit.
    Searching a bit in the web I found that in the version 8 there is already a VI for this fitting. I guess should be possible with a bit of math to write a subVI, but I have some problem to estimate the weights. is someone can help me?
    And just another question: which of these fitting methods is the best:
    -least square
    -Least Absolute Residual
    -Bisquare
    Thanks

    Hi laser81,
    Thanks for posting your query on the National Instruments forums.
    If you are new to LabVIEW then I would like to strongly recommend that you consider pursuing the LabVIEW Basics courses. The LabVIEW Basics 1: Introduction course is part of a series of courses designed to build your proficiency with LabVIEW and help you prepare for NI LabVIEW certification exams.
    The courses offer:
    The most efficient way to learn LabVIEW
    Training courses for new and experienced users
    Hands-on training with experienced LabVIEW instructors
    Basics courses to help you get started quickly
    Intermediate courses to help you learn how to optimize applications
    Advanced courses to help you learn advanced features and architectures
    The context help for linear fit VI in LabVIEW version 7.1 states:
    Finds the line values and the set of linear coefficients slope and intercept, which describe the line that best represents the input data set using the least-squares solution.Finds the line values and the set of linear coefficients slope and intercept, which describe the line that best represents the input data set using the least-squares solution.
    The context help for linear fit VI in LabVIEW version 8.2 states:
    Returns the linear fit of a data set (X, Y) using the Least Square, Least Absolute Residual, or Bisquare method
    If you then click the detailed help link in the context help window it will fire up the LabVIEW help document file where the help file explains the differences between Least Square, Absolute Residual and Bisquare method and equations are given.
    I have attached the help file to this forum. Have you considered upgrading to the latest release of LabVIEW? It is jam packed with even more technology.
    Check out the release notes for more information on what’s new with a particular release. Please goto www.ni.com/manuals
    I have also found a similar discussion forum link that might be offer some help on the issue this explains a programmatic approach to curve fitting using low level VI’s in LabVIEW.
    http://forums.ni.com/ni/board/message?board.id=170&message.id=181569&requireLogin=False
    I hope this helps
    Best Regards,
    Kirtesh Mistry
    National Instruments UK & Ireland

  • Linear Fit errors

    I am trying to make use of the "Linear Fit" and "Linear Fit Coefficients" vi's, but I am getting errors despite inputting what I thought was correct. If I connect my two 1D data arrays to the 'X' and 'Y' input terminals then I get the error -20002.  If I connect empty arrays, I get the error -20006.  I'm leaving all the other inputs unconnected.
    In looking for a solution to this, I came across something altenbach said a few years ago:
    altenbach wrote:
    Some possible errors that can occur with linear fit (but they would generated different error codes):
    You have only a two-column file. In this case you need columns 0 and 1 (column 2 does not exists) error -20002
    You have only one row, thus only one data point. error -20006.
    I only half-understand what he meant, and/or how it would apply to what I'm doing wrong.  Can anyone help me out here?
    Never say "Oops." Always say "Ah, interesting!"
    Solved!
    Go to Solution.

    Please attach code.
    -20002 states that the input sequences must be the same size.  So X and Y need to be the same length.  Verify this first.
    -20006 states that the input lengths must be at least 2 elements.  So passing in empty arrays makes perfect sense here.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

Maybe you are looking for

  • Using JavaScript to Print and Overwrite Active Form Files

    Hello all, I have zero knowledge of JavaScript and I am hoping someone can help me quickly solve an issue I am having with active forms. I tried using the flatten feature in the action wizard but it is not working. I also tried using "this.flattenPag

  • JDBC Connect Issues

    So, I have the same project, but thought I would start a new string for this new issue. I don't have an Oracle client on my server, and I am trying to do a connect though a cfscript/createObject to pull Jasper Reports into Coldfusion. I guess I was w

  • Social Media and The Studio

    I'm currently due for an upgrade, and I want to stick with a feature phone.  I'm stuck on weather I should get the LG Cosmos Touch or the KIN TWOm.  I'm leaning towards the KIN TWOm right now, but I need to know a few things.  I recently read an arti

  • When will the next JDeveloper be released ?

    Hi All, Can anyone tell me when the next Version of JDeveloper will be released which will support Oracle 10g AS 10.1.4 , Thanks Regards

  • Need driver for on-board ethernet interface

    I am seaching on an ethernet nic driver for Solaris 8 x86 O/S is Solaris 8 4/01 x86 HW is Toshiba Laptop A15-S127 prtconf -pv reports the following: VendorID --- 0x8086, DeviceID -- 0x103d model: 'PCI: 1179,1 class: Ethernet controller' name: 'pci117