Problems about nonlinear least square( waiting online)

This time I met a problem again,as you see when I set the parameters Amplitude=10000 or greater ,then the output will not turn out .
Another problem is the derivative of the output on the waveform wobble after I click run for a while
As a man you should be ....
Attachments:
ZQH_BYSJ.llb ‏330 KB

Can you explain what you mean by wobble? (e.g. attach a picture)
Your toplevel VI only runs once because there is no while loop. How do you run it "for a while" then? I pressed the run button 50 times, but nothing changed....
If your amplitude is set to 10000, the function has a range of over 10^17, mostly because you take the fourth power. On that same scale, the influence of the lower order terms(a , b) now only contribute an infinitesimal small fraction to the signal (way beyond the scope of DBL or EXT) and thus can no longer be determined. Your problme is out of balance because the C and D completely dominate the result. As explained elsewhere, you need to keep your amplitude in a reasonable range and instead scale the fitting parameters.
LabVIEW Champion . Do more with less code and in less time .

Similar Messages

  • Nonlinear least square fit problem

    Hello,
           I have been trying to fit the data given in the attached file. When you click command button1, the routine goes thru the NonLinearFitModelProcedure, calculates some points and gives an error message like "The return parameter in NonLinearFitCallback must be assigned a scalr value". I do not understand this error message. Any ideas? Thank you.
    Cem
    Option Explicit
    Const numpoints = 49
    Private Sub CWStat1_NonLinearFitModelProcedure(x As Variant, c As Variant, f As Variant)
        ' Enter the equation to fit in this callback.
        ' The fitter will attempt to find the best set of Coefficients that will fit the model result (f)
        ' to the expected result (y) generated by the GenerateData subroutine below.
        ' In this example, we fit the data to an exponential (f = a * exp(b*x) + c).
        'f = Coefficients(0) * Exp(Coefficients(1) * x) + Coefficients(2)
            If x <= c(1) Then
                f = 0
            ElseIf x >= c(1) And x <= (c(1) + c(2)) Then
                f = 2 * (1# - Exp(-c(0) * (x - c(1))))
            ElseIf x >= (c(1) + c(2)) And x <= (2# + c(2)) Then
                f = 2 * Exp(-c(0) * x) * Exp(c(0) * c(1)) * (Exp(c(0) * c(2)) - 1#)
            End If
            Debug.Print x, f
    End Sub
    Private Sub Form_Load()
        Open "fldwhite.txt" For Input As #1
    End Sub
    Private Sub Command1_Click()
        'Compute the fit now.
        ComputeFit
    End Sub
    Private Sub GenerateData(x As Variant, Y As Variant)
        Dim i
        Dim dum
        Input #1, dum, dum
        ReDim x(numpoints)
        ReDim Y(numpoints)
        i = 0
        Do While Not EOF(1)
            i = i + 1
            Input #1, x(i), Y(i)
        Loop
    End Sub
    Private Sub ComputeFit()
        Dim x, Y, z, ynoisy, MSError, coef
        ' generate sample data
        GenerateData x, Y
        a0 = 0.02
        b0 = 2
        c0 = 2
        ' initial guess coefficients
        coef = Array(a0, b0, c0)
        ' perform the fit
        ' The function returns the results within coef.
        ' The function also returns a gauge of the results as MSError.
        ' A higher value for this number implies a "worse" fit.
        z = CWStat1.NonLinearFit(x, Y, coef, MSError)
        ' plot the results:
        '   Plot1 = Original data
        '   Plot2 = Original data plus noise
        '   Plot3 = Fitted curve
        CWGraph1.PlotXvsY x, CWArray1.BuildArray(Array(Y, z))
        ' Display computed coefficints and Mean Squared Error
        a1.Caption = Format(coef(0), "0.0##")
        b1.Caption = Format(coef(1), "0.0##")
        c1.Caption = Format(coef(2), "0.0##")
        mse.Caption = Format(MSError, "0.00E+00")
    End Sub
    Attachments:
    fldwhite.txt ‏1 KB

    Hello Sam,
         Thank you for the reply. The error number was something like 10024(?) I found out that my problem was to do with the function definition. The function limits were not set right. When I corrected it worked. But you are right that somehow I do not define the type correctly. See the routine below:
          The xData and yData are defined as variant, likewise the yFit variable. The first two are populated in a for loop, therefore they are redimensioned prior to this. On the other hand the yFit variable is filled as an array by the NonLinearFit routine. This typing works for the fit routine, but it doesn't work for the plot routine where two differently typed variables, yData and yFit are used as arguments of the Array function. In order to make this to work I used CWDSP function for the XData, yData arrays which is an overkill. What is the reasonable solution for type casting these variables? Thank you.
    Cem
    Private Sub cmdFit_Click()
    Dim i As Integer
    Dim j As Integer
    Dim k As Integer
    Dim NCoeff As Integer
    Dim Coefficients
    Dim mse
    Dim yFit
    Dim xData
    Dim yData
    Dim tArray() As Double
        With sprResults
            For j = 0 To 4
    '            xData = CWDSP1.Ramp(nPts(j), 0, 1)
    '            yData = CWDSP1.Ramp(nPts(j), 0, 1)
                ReDim xData(0 To nPts(j) - 1)
                ReDim yData(0 To nPts(j) - 1)
                 For i = 0 To nPts(j) - 1
                        xData(i) = CDbl(sTime(i))
                        yData(i) = CDbl(sData(i, j))
                Next
                fitType = j
                NCoeff = 2
                Coefficients = Array(CoefValues(0), CoefValues(1))
                yFit = CWStat.NonLinearFit(xData, yData, Coefficients, mse, 25)
                cwgPlot(j).PlotXvsY xData, CWArray.BuildArray(Array(yData, yFit))
            Next
    End With
    End Sub

  • Confusion about make Thread running(waiting online)

    the code like this
    class a implements Runnable{
    public void run(){
    while(true){};
    class App {
    public static void main(String arg[]){
    a mya=new a();
    (new Thread(mya)).start();
    (new Thread(mya)).start();
    the two thread will run simultaneously .
    could u tell me what's the order and step the two thread become runnable and then run.
    why the two thread could run simultaneously?
    They are the same priority and one is busy enough not to let others to run.
    but actually they did run simultaneously.
    why one thread could become runnable state and then running automaticatically!

    I can't really understand your problem, but i think it this here:
    A runnable class should look like this:
    class myThread implements Runnable {
    Thread thisThread
    myThread () {
    thisThread = new Thread(this);
    thisThread.start();
    public void run () {
    while (Thread.currentThread() == this) {
    //Do anything
    class App {
    public static void main (String a[]) {
    (new myThread).start();
    (new myThread).start();
    This program will generate two threads, and as it's the sense of threads the will run simultaneously.
    if you call start() of a thread, this will start the thread and goto next line, while the tread calls his run().
    But where is the problem????

  • Question about DTR...Wait Online~~~~~~~~~

    In Netweaver2004S,I log on SLD as NWDI_ADM,when I create SC upon the System,From the SC details page of the SC created above, define usage dependencies,the Context is null.(the Was Server is 2004S SR2)
    IS the other SCs needed to develop CAF and GP applications in NWCE7.1?
    suah as
    DI BUILD TOOL 7.10
    J2EE ENGINE FACADE 7.10
    JAVA FRAMEWORK OFFLINE 7.10
    WEB DYNPRO RUNTIME 7.10
    Log on My NWCE7.1 (Trial Sp3) SLD page as Administration,I can see a lot of product.
    But on Netweaver2004S,as NWDI_ADM,there is only one that I just create in the system a few minute
    ago.
    In Develop Studio,I can create Develop configuration from the SLD,I can used it to create DC in version 7.0.
    But In the Develop Studio7.1CE, does not support the DC Type.
    if I want use the DTR form 2004S SR2,How can I fix it?

    HI
    You said
    IS the other SCs needed to develop CAF and GP applications in NWCE7.1?
    yes you need other many dependencies
    as CAF,CAF-MF,,,,
    check this url if you want to setup a track for CAF and GP development
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/7014086d-3fd9-2910-80bd-be3417810c6f

  • How to solve a problem about an Apple Authorized Distributor . . .

    hello to all ... I am Vlad from Romania
    from the beginning ... maybe I will not find an answer here
    but I reached a point of desperation ... so I will tell you my story ... and I hope that someone will hear me and maby help me
    in 13 December 1012 ...
    I placed an order in worth of over 10.000 USD to the only and exclusive Apple Authorized Distributor from Romania ... www.apcom.ro
    I even paid a percentage of the total amount in advance ... and now after 2 months I have not received my products
    so
    after heated discussions with the Apple Authorized Distributor from Romania (APCOM) ... the only thing they kept saying : it is not their fault !!! it is Apple's fault ... even a tiny bit my fault ... because I ordered for my 27" iMac's the Custom Configurations ... I used the Configure your iMac option
    now
    I bought these Apple products ... through a co-financing program with the European Union ... it is a special program to help business development in Romania ... an my deadline is at the end of this month February 2013 ... if I do not receive them by the end of February ... I lose everything ... all the money ... and most likely it will start a whole scandal along the line of these Apple products ... I already used all my rights for time extension / delivery time
    by myself ... I called all over ... Apple Customer Support in USA in UK ... even a phone number that Apple Authorized Distributor from Romania (APCOM) gave me (0800 894847) ... even gave me an order number (Proposal 2100545504) ... still no luck
    everybody keeps repeating : I can not help you !!! I can not help you !!! I can not help you !!!
    so I ask ... it is my fault I'm an Apple User ??? ... because I love Apple products ???
    what I can do ???
    who can help me ???
    who and how to contact at Apple ???
    that's my BIG BIG BIG problem ... and I do not know what to do ???
    thanks to all
    and I hope someone will guide me in the right direction
    K

    Hi..and thx for you replay ... this problem ... my problem started in September 2012
    in September 2012 I first order from Apple Authorized Distributor from Romania ... www.apcom.ro ... the older models but in custom configurations
    I made the order and I even paid 30% or 40% money in advance as required from Apple Authorized Distributor
    and after 30 days
    they called me and told me : we can no longer deliver the old models customized configurations ... because Apple blocked all the orders for customized configurations on older models ... only if you whant the standard configurations ...
    I have no use for the standard models ... old or new ... I need or better to say it is mandatory for me to have the processor Quad-Core Intel Core i7
    so you see this is absurd ... no older models and no new models 27" with i7 processor in standard configuration
    in Romania the new models ... Intel i5 standard configurations ... are no problem ... but for custom configurations it seems to be a big big problem
    so what can I do ???
    after 60 days of waiting from the order on the new models 27" with i7
    and
    after about 5 months of waiting from the initial order in September

  • Problem about space management of archived log files

    Dear friends,
    I have a problem about space management of archived log files.
    my database is Oracle 10g release 1 running in archivelog mode. I use OEM(web based) to config all the backup and recovery settings.
    I config "Flash Recovery Area" to do backup and recovery automatically. my daily backup schedule is every night at 2:00am. and my backup setting is "disk settings"--"compressed backup set". the following is the RMAN script:
    Daily Script:
    run {
    allocate channel oem_disk_backup device type disk;
    recover copy of database with tag 'ORA$OEM_LEVEL_0';
    backup incremental level 1 cumulative copies=1 for recover of copy with tag 'ORA$OEM_LEVEL_0' database;
    the retention policy is the second choice, that is "Retain backups that are necessary for a recovery to any time within the specified number of days (point-in-time recovery)". the recovery window is 1 day.
    I assign enough space for flash recovery area. my database size is about 2G. I assign 20G as flash recovery area.
    now here is the problem, through oracle online manual, it said oracle can manage the flash recovery area automatically, that is, when the space is full, it can delete the obsolete archived log files. but in fact, it never works! whenever the space is full, the database will hang up! besides, the status of archived log files is very strange, for example, it can change "obsolete" stauts from "yes" to "no", and then from "no" to "yes". I really have no idea about this! even though I know oracle usually keep archived files for some longer days than retention policy, but I really don't know why the obsolete status can change automatically. although I can write a schedule job to delete obsolete archived files every day, but I just want to know the reason. my goal is to backup all the files on disk and let oracle automatically manage them.
    also, there is another problem about archive mode. I have two oracle 10g databases(release one), the size of db1 is more than 20G, the size of db2 is about 2G. both of them have the same backup and recovery policy, except I assign more flash recovery area for db1. both of them are on archive mode. both of nearly nobody access except for the schedule backup job and sometime I will admin through oem. the strange thing is that the number of archived log files of smaller database, db2, are much bigger than ones of bigger database. also the same situation for the size of the flashback logs for point-in-time recovery. (I enable flashback logging for fast database point-in-time recovery, the flashback retention time is 24 hours.) I found the memory utility of smaller database is higher than bigger database. nearly all the time the smaller database's memory utility keeps more than 99%. while the bigger one's memory utility keeps about 97%. (I enable "Automatic Shared Memory Management" on both databases.) but both database's cup and queue are very low. I'm nearly sure no one hack the databases. so I really have no idea why the same backup and recovery policy will result so different result, especially the smaller one produces more redo logs than bigger one. does there anyone happen to know the reason or how should I do to check the reason?
    by the way, I found web based OEM can't reflect the correct database status when the database shutdown abnormally. for example, if the database hang up because of out of flash recovery area, after I assign more flash recovery area space and then restart the database, the OEM usually can't reflect the correct database status. I must restart OEM manually to correctly reflect the current database status. does there anyone know in what situation I should restart OEM to reflect the correct database status?
    sorry for the long message, I just want to describe in details to easy diagnosis.
    any hint will be greatly appreciated!
    Sammy

    thank you very much, in fact, my site's oracle never works about managing archive files automatically although I have tried all my best. at last, I made a job running daily to check the archive files and delete them.
    thanks again.

  • I need to plot the Least Squares Regression Line (not just calculate it with the LINEST function).  How?

    I need to plot the Least Squares Regression Line (not just calculate its values with the LINEST function).  Can anyone advise me on how to graph this line?

      Grapher.app in OS X Utilities is excellent for that : entering data from Numbers Excel etc. into a Grapher "Point Set", plotting all your data, computing and plotting a regression curve linear or exponential or polynomial.
      Unfortunately there is not a single word about point sets and regression in the Grapher Help.
    So, suggest you download (free) "Instruction for Use - Grapher on web site
    http://y.barois.free.fr/grapher/Documentation.html
    and go to page 31 to 37, "Initiation > Lesson 6 : Treating a point set (Regression curve), and also page 68, "Appendix 1. Points sets : from speadsheets to Grapher".
      If you try Grapher's regression curves, please tell us about the manual above : useful or not, too easy or difficult, readable or not etc.
      Thank you.
    YB24
    PS. Documentation about Grapher is also here : Google "Apple Grapher" > http://en.wikipedia.org/wiki/Grapher > Article > Talk > Grapher 1.1 to 2.3 (French and English) (11th september 2012)

  • Least squares from file

    hi i have a final project i have to write least squares best fit vi,vi should read the datas from a txt file and draw best fit line according to least squares method calculations and also it should show the datas in point form pls help to me i tried a lot but i got nothing...thx

    Hey siktigit ys,
    There are built in Least Square Fit functions in LabVIEW. Here is some information about them. If you are having trouble reading the data from the file, here is an example showing how to use the read and write VIs. In order to show your data in a graph, I'd just read the data from the text files into an array and display that array on an XY graph. That should be enough to get you started. If you need more help, just let me know and have a great weekend!
    John B.
    Embedded Networks R&D
    National Instruments
    Certified LabVIEW Developer

  • Linear Least-Squares Fit

    Im farely new to programming and I got stuck with a linear least-squares fit problem. I am supposed to develop a method that will calculate slope and intercept of the least-squares line that best fits an input data set.
    Ive been trying to figure out just how to write this program for a couple of days, but with no luck.
    Can anyone give me some tips on how to write this program and what the finished program should look like?
    Any help would be greatly appreciated

    Atleast I believe that I am needed to return a graph. The assignment says
    "Test your method usin a test driver program that calculates the least-squares fit to the following 20-point input data set, and plots both the original input data and the resulting least-squares fit line"
    And then itgives me a chart of the x and y values

  • Multi variate damping least square solver

    Hello all,
    I am hoping to get some advice and a starting point for a challenging problem I am working on.
    I have a 33x37 matrix that i need to minimize using a damping least square approach.  in order to achieve the minimization I need to use a set of 50 Matrices (33x37, representing adjustment impacts) that are grouped in 12 separate catagories with different starting points and degrees of freedom, and none of the adjustment matrices are truly independent of each other (they all interact with each other to some extent.)
    For the output I need the minimized matrix and the amount of each vector applied to achieve the minimized solution.
    To hopefully clarify the inputs and outputs I have included an example vi with a dummy set of data.
    I am hoping that someone can give me an idea of where to start, can this be accomplished using the labview libraries or will this have to use scripting via a mathscript node, or matlab?  If it can be done in different ways which method is the most efficient?
    I hope this is enough information, but if you need more details please let me know, although giving exact details can be difficult in this case due to IP considerations.
    As always thank you in advance for any help/suggestions you may be able to offer.
    Chris
    Attachments:
    example2.vi ‏25 KB

    Other then using a least square method I dont have a function defined yet (trying to figure out what function to use), but essentially I am trying to find out how much of each of the adjustment matrices need to be applied to minimize the original matrices..
    I hope that explains what i am trying to do a little better

  • Have you experience a problem about losing your internet after downloading itunes? How to fix it?

    Have you experience a problem about losing your internet after downloading itunes? How to fix it?

    - Try cleaning out/blowing out the headphone jack. Try inserting/removing the plug a dozen times or so.
    Try the following to rule out a software problem
    - Reset the iPod. Nothing will be lost
    Reset iPod touch: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Reset all settings
    Go to Settings > General > Reset and tap Reset All Settings.
    All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
    - Restore from backup
    - Restore to factory settings/new iPod.
    - Make an appointment at the Genius Bar of an Apple store. Seems you have a bad headphone jack.
    Apple Retail Store - Genius Bar
    Apple will exchange your iPod for a refurbished one for this price. They do not fix yours.
    Apple - iPod Repair price
    A third-party place like the following will replace the jack for less. Google for more.
    iPhone Repair, Service & Parts: iPod Touch, iPad, MacBook Pro Screens
    Replace the jack yourself

  • While trying to restore os x and erase content, some problem about voice software came up and the computer asked me to restart and try again by clicking restart button. When I did this, the machine went to a gray start up screen and will not progress.

    While trying to restore os x and erase content on my MacBook pro, some problem about voice software came up and the computer asked me to restart and try again by clicking restart button. When I did this, the machine went to a gray start up screen with an apple and will not progress. I've waited more than 30 minutes and tried restarting again by holding the power button. Also, restore cd 1 will not eject so the computer will no longer move past the gray screen with spinning circle. Restore CDs had never beeused and were still in packaging in the original box. Ran hardware test just to check, and it came back as normal. Now what? I live nowhere near a genius bar :(

    computer asked me to restart and try again by clicking restart button.
    That's called a kernel panic...
    Since the install disc won't eject, try starting up while holding down the C key. If the Mac won't boot while holding down the C key, try ejecting disc by either holding down the mouse while starting up or holding down the Eject key while starting up.
    Try booting from your install disc so you can run Disk Utility in case the startup disk needs repairing.
    Insert your install disk and Restart, holding down the "C" key until grey Apple appears.
    Go to Installer menu and launch Disk Utility.
    (In Mac OS X 10.4 or later, you must select your language first from the installer menu)
    Select your HDD (manufacturer ID) in the left panel.
    Select First Aid in the Main panel.
    (Check S.M.A.R.T Status of HDD at the bottom of right panel. It should say: Verified)
    Click Repair Disk on the bottom right.
    If DU reports disk does not need repairs quit DU and restart.
    If DU reports errors Repair again and again until DU reports disk is repaired.
    When you are finished with DU, from the Menu Bar, select Utilities/Startup Manager.
    Select your startup disk and click Restart
    While you have the Disk Utility window open, look at the bottom of the window. Where you see Capacity and Available. Make sure there is always 15% free space.
    What is a kernel panic
    Mac OS X Kernel Panic FAQ
    Resolving Kernel Panics

  • The covariance of the least square methods

    what is the meaning of the covariance? In the least square method fitting problems ,if I should make it equal to zero??
    If it isnt equal to zero ? what is the matter?
    thanks for any one can explain it to me !
    As a man you should be ....

    Hi Sharad,
    Try to rename the component name and reload+rebulid the project.
    If there is any build errors try to repair the DC with classpath structure and deploy the DC in server.
    Hope this helps you...
    Regards,
    Saleem Mohammad

  • An old and difficult problem about "UnsatisfiedLinkError"

    Hi dear all,
    I have been struck with the problem about "UnsatisfiedLinkError". I have a c++ class HelloWorld with a method hello(), and I want to call it from within a java class. In fact, I have succeeded in calling it on the windows platform. But when I transfer it to linux, the error "UnsatisfiedLinkError" comes out. I have tried to take the measures as Forum has suggested, but it failed.
    The source code is very simple to demonstrate JNI.
    "HelloWorld.h"
    #ifndef INCLUDEDHELLOWORLD_H
    #define INCLUDEDHELLOWORLD_H
    class HelloWorld
    public:
    void hello();
    #endif
    "HelloWorld.cpp"
    #include <iostream>
    #include "HelloWorld.h"
    using namespace std;
    void HelloWorld::hello()
    cout << "Hello, World!" << endl;
    "JHelloWorld.java"
    public class JHelloWorld
    public native void hello();
    static
    System.loadLibrary("hellolib");
    public static void main(String[] argv)
    JHelloWorld hw = new JHelloWorld();
    hw.hello();
    "JHelloWorld.cpp"
    #include <iostream>
    #include <jni.h>
    #include "HelloWorld.h"
    #include "JHelloWorld.h"
    JNIEXPORT void JNICALL Java_JHelloWorld_hello (JNIEnv * env, jobject obj)
    HelloWorld hw;
    hw.hello();
    All the files are in the same directory and all the processes are under the dirctory:
    1. javac JHelloWorld.java
    2. javah -classpath . JHelloWorld
    3. g++ -c -I/usr/java/jdk1.3/include -I/usr/java/jdk1.3/include/linux JHelloWorld.cpp HelloWorld.cpp
    4. ld -shared -o hellolib.so *.o
    5. java -cp . -Djava.library.path=. JHelloWorld
    Exception in thread "main" java.lang.UnsatisfiedLinkError: no hellolib in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1349)
    at java.lang.Runtime.loadLibrary0(Runtime.java:749)
    at java.lang.System.loadLibrary(System.java:820)
    at JHelloWorld.<clinit>(JHelloWorld.java:7)
    Tried another measure:
    i) export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH
    ii)java -cp . JHelloWorld
    The same error came out as above.
    I really don't know what is wrong with it.
    Would you like to help me as soon as possible?
    Thanks.
    Regards,
    Johnson

    Hi Fabio,
    Thanks a lot for your help.
    It is very kind of you.
    Regards,
    Johnson

  • A problem about calling Labview vi in VB

    Hi all:
    I meeting a problem about data transfer and parallel operation between VB and Labview.
    Actually, I want develop a VB program, in which, the Labview VI can be called and corresponding parameters can be transferred to Labview. and then, I also can operate my system by VB program at same time. something like parallel operation (VB and Labview program).
     But the question is :
    1.   If I use "Call" method of ActiveX in VB,  and the LabVIEW subvi is not stopped (for example, a loop structure), I can not do  parallel operation on VB program. The error message is "other application is busy" which is attached below. The sample codes is also attached.
    2.   I tried to use other methods like "OpenFrontPanel" and "Run", but I am not sure how to transfer the parameter??
    3.  Then I tried to use "SetControlValue" to set the parameters, but there is a error " := expected", which is very strange, because the statement  I wrote is followed with the help documents [ eg: VI.SetControlValue ("string", value)], why it is still need a "=" ??
    Does anybody know something about it? Thanks a lot
    Message Edited by hanwei on 11-07-2008 03:18 PM
    Attachments:
    vb_labview_error_message_1.JPG ‏14 KB
    VB_to_LV.zip ‏10 KB

    I sure hope OP has solved it by now.
    /Y
    LabVIEW 8.2 - 2014
    "Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
    G# - Free award winning reference based OOP for LV

Maybe you are looking for