Fit functions with optionally fixed parameters?

How can I fit functions ranging from a basic linear fit to any
user-defined function to a set of x-y data with the option of keeping
single fit parameters fixed (e.g. a known slope in a linear fit)? One
possibility would be creating an according formula for the
Levenberg-Marquard-algorithm each time a parameter is set to be fixed
but that seems to be a bit inconvenient. Is there a simple approach to
this problem, I guess I'm not the first to try it? Thanks a lot,
Daniel

dtroendle wrote:
How can I fit functions ranging from a basic linear fit to any user-defined function to a set of x-y data with the option of keeping single fit parameters fixed (e.g. a known slope in a linear fit)? Is there a simple approach to this problem, I guess I'm not the first to try it?
Daniel,
I have modified the Lev-Mar routines long ago to allow the runtime selection of which paramters should be fixed and which should be held constant. It is not very difficult to implement. I use it to fit EPR spectra where the model can have up to ~30 parameters, but typically only less than 10 are fit while the rest are kept constant.
Basically, I added a boolean array as input to Lev-Mar which has the same number of elements as the number of paramters of the model function. For each element, a TRUE means that the corresponding parameter should be fit while a FALSE means that the corresponding parameter should be held fixed at the value of the initial estimate.
You just need to seperate out the reduced problem for the fitting part, but carry all parameters along for the model calculation.
It works great!
I am currently traveling in Japan and don't have access to my VIs. Please contact me next week by private e-mail (You can find my e-mail address on the FP of some of my examples posted here, e.g. HERE.
LabVIEW Champion . Do more with less code and in less time .

Similar Messages

  • Hierarchy on HANA Calculation View with Optional Input Parameters Fails

    Hi,
    Has anyone succeeded in building a hierarchy on top of a calculation view with optional input parameters, where an input parameter is not filled?
    The original requirement came from the wish to create a parent child hierarchy on a calculation view that was copied into the customer space from a HANA Live Financial Statement query view, but I have found the following when creating a simple level hierarchy on a calculation view that consumes one table. The Calculation View has one Input Parameter where the 'mandatory' box is unchecked.
    Calculation view reads ECC table FAGLFLEXT
    Simple level based hierarchy on fields PRCTR, RACCT and SEGMENT
    Input parameter is used as a filter for PRCTR with logic ("EMPTY" = '$$P_PROFITCTR$$' or "PRCTR" = '$$P_PROFITCTR$$')
    When I run the view I see the following behaviour in HANA Studio and Analysis for Excel
    Before building the hierarchy I could run the view with or without the Input Parameter
    After building the hierarchy I can run the view with the Input Parameter filled, but it fails when the Input Parameter is not filled.
    Error message is "error: search table error:  [2426] missing placeholder; missing value for mandatory parameter P_PROFITCTR"
    P_PROFITCTR is not a mandatory parameter, but the selection for the hierarchy view thinks it should be. I don't find any notes around this issue, so I don't think it's version related, however the version I have used for this test is 1.00.70.
    It's a shame we can't currently build the hierarchy as the parent child relationship is provided in HANA Live view NewGLFinancialStatementQuery.
    Thanks,
    Ken

    Hi Ken,
    We have been facing similar issue. We have even tried to set default value and as optional parameter. View still fails to create hierarchy (we are not using HANA live). As mentioned on page 97 of HANA modelling guide input parameter is mandatory from engine point of view. Hierarchy is generated as column view during the initial activation of calculation view and therefore expect a value by caller.
    This seems to be a product error. Some one from HANA development team should explain this issue in detail. I would expect someone like Thomas Jung reply to us.
    At the moment, we cant use input parameter for date prompt which gives us calendar popup feature for date selection. Hierarchies just don't work with input parameter. We are missing something.
    Regards
    Angad

  • Using JOIN Function with NULL Dynamic Parameters

    I have a report with utilizes dynamic parameters but will not run if any of the parameters are null.  I am also using the JOIN function to print out the values of these parameters. If the user doesn't enter in all the parameters, can the report still run?

    Hi eburton 
    In CR 2008 we have optional parameter functionality, this will allow the report to run without parameter values.
    If you are not using CR2008 then the functionality is not available.
    Thanks,
    Sastry

  • Using the "fit" function with "mFct" ?

    having a problem with declaring a function and using it in a nonlinear least squares fit:
    function Fit5(a,x,y)
    rslt5 = a[1]*(2.0*besselj(sqrt(.....;
    return rslt5;
    end function;
    [a, res1, q1, qVar1] = fit(g, Top_data, fit5, guess,,,iterMax,w,rho );
    getting the following error message:
    is not a valid signature for the function"fit"

    having a problem with declaring a function and using it in a nonlinear least squares fit:
    function Fit5(a,x,y)
    rslt5 = a[1]*(2.0*besselj(sqrt(.....;
    return rslt5;
    end function;
    [a, res1, q1, qVar1] = fit(g, Top_data, fit5, guess,,,iterMax,w,rho );
    getting the following error message:
    is not a valid signature for the function"fit"

  • Bind Operator to Function with optional parameter

    Hi,
    as mentioned in the subject, I would like to create an operator which is bind to an function with an optional parameter:
    CREATE OR REPLACE FUNCTION
              TS_Base_Func(iobject IN CIBase, format IN VARCHAR2 DEFAULT NULL) RETURN VARCHAR2 IS
    BEGIN
         RETURN interval_object.IntervalToString(format);
    END TS_Base_Func;
    I can bind the operator with a VARCHAR2 as second parameter, but how can I bind an operator without the second parameter to this function?
    Thanks!

    What about using a "wrapper" function to implement what you would like to do? Here is a small sample:
    SQL> CREATE OR REPLACE FUNCTION TEST
      2  (
      3          A       IN VARCHAR2
      4  ,       B       IN VARCHAR2     DEFAULT NULL
      5  )
      6  RETURN NUMBER
      7  AS
      8  BEGIN
      9          IF A = B THEN
    10                  RETURN 1;
    11          ELSE
    12                  RETURN 0;
    13          END IF;
    14  END;
    15  /
    Function created.
    SQL> CREATE OR REPLACE FUNCTION TEST_WRAPPER
      2  (
      3          A       IN VARCHAR2
      4  )
      5  RETURN NUMBER
      6  AS
      7  BEGIN
      8          RETURN TEST(A);
      9  END;
    10  /
    Function created.
    SQL> CREATE OR REPLACE OPERATOR TestOperator
      2  BINDING (VARCHAR2)              RETURN NUMBER USING TEST_WRAPPER
      3  ,       (VARCHAR2, VARCHAR2)    RETURN NUMBER USING TEST;
    Operator created.
    SQL> SELECT  TestOperator(1) FROM DUAL;
    TESTOPERATOR(1)
                  0
    SQL> SELECT  TestOperator(1,2) FROM DUAL;
    TESTOPERATOR(1,2)
                    0
    SQL> SELECT  TestOperator(1,1) FROM DUAL;
    TESTOPERATOR(1,1)
                    1
    SQL>The TEST_WRAPPER function has the signature you need for a one variable parameter. However, under the hood it calls the TEST function.

  • DBMS_SCHEDULER.CREATE_PROGRAM with Optional input parameters

    I have a procedure that has a number of "optional" parameters.
    procedure get_files(
    file_name_in in varchar2 default 'dummy_file',
    layout_in in number default 1,
    client_in in number default null,
    data_supplier_in in number default 99999
    This procedure can be called with any combination of the input parameters.
    I can set up program(s) using the DBMS_SCHEDULER.CREATE_PROGRAM procedure using a program_type => 'PLSQL_BLOCK' like this:
    begin
    sys.dbms_scheduler.create_program(
    program_name => 'GET_MY_FILES',
    program_action => '
    declare
    begin
    get_files( layout_in => 11111, client_in => 2222 );
    end ;',
    program_type => 'PLSQL_BLOCK',
    number_of_arguments => 0);
    end;
    My question is: Can I set up programs(s) using the DBMS_SCHEDULER.CREATE_PROGRAM procedure using a program_type => 'STORED_PROCEDURE' when I have "optional" parameters?
    It appears that ALL of the program input parameters must be defined and there is no way to indicate that a parameters is "optional".

    Yes you can do it.
    You can defined default values for program parameters, but this values are "constants". So if your default value of parameter is defined by function call you have a problem, because you have to specify this parametr every time.
    procedure my_proc(p_date IN DATE := SYSDATE) AS
    ...There is my example, it using DBADMIN schema create this schema or replace it.
    create or replace procedure dbadmin.sleep(p_interval in number)
    as
    begin
      dbms_lock.sleep(p_interval);
    end;
    --program definition
    begin
        dbms_scheduler.create_program(program_name => 'dbadmin.prg_test1',
                                      program_type => 'STORED_PROCEDURE',
                                      program_action => 'dbadmin.sleep',
                                      number_of_arguments => 1);
        dbms_scheduler.define_program_argument(program_name => 'dbadmin.prg_test1',argument_position => 1,argument_type => 'NUMBER',default_value => 60);
        dbms_scheduler.enable(name => 'dbadmin.prg_test1');                                 
    end;
    --check that program was created
    select * from dba_scheduler_programs
    where owner='DBADMIN';
    select * from dba_scheduler_program_args
    where owner='DBADMIN';
    BEGIN
        dbms_scheduler.create_job(job_name        => 'dbadmin.job_program1',
                                  program_name    => 'dbadmin.prg_test1',
                                  start_date      => to_timestamp_tz('1.1.2010 12:00 Europe/Prague', 'dd.mm.yyyy hh24:mi tzr'),
                                  repeat_interval => 'FREQ=minutely; INTERVAL=2;BYSECOND=0',
                                  auto_drop       => FALSE);
        dbms_scheduler.enable(name => 'dbadmin.job_program1');
    END;
    --job run checks
    SELECT *
    FROM   dba_scheduler_jobs j
    WHERE  j.JOB_NAME = 'JOB_PROGRAM1';
    SELECT *
    FROM   dba_scheduler_job_log jl
    WHERE  jl.JOB_NAME = 'JOB_PROGRAM1';
    SELECT *
    FROM   dba_scheduler_job_run_details jr
    WHERE  jr.JOB_NAME = 'JOB_PROGRAM1';   
    --now set job parametr
    BEGIN
        dbms_scheduler.set_job_argument_value(job_name => 'dbadmin.job_program1', argument_position => 1, argument_value => 30);
    END;
    --clean up
    BEGIN
        dbms_scheduler.drop_job(job_name => 'dbadmin.job_program1', force => TRUE);
        dbms_scheduler.drop_program(program_name => 'dbadmin.prg_test1');
        dbms_scheduler.purge_log;
    END;
    /

  • Function with lower case parameters

    Hi all,
    Can anyone explain me how to create import parameters for a function which allows and passes lower case characters?
    In a abap program is done like this
    parameters: user(64) type c lower case.
    Thanks for any help?
    Jan

    Hi
    You don't need it because depends on format your using while transfering a value to interface of fm.
    The program maintains the format of a variable, only the selection-screen convert the parameter if it's used a type doesn't support the lowercase.
    Anyway you can use the command TRANSLATE:
    A: TRANSLATE <FIELD> TO UPPER CASE.
    B: TRANSLATE <FIELD> TO LOWER CASE.
    Before moving <FIELD> to FM
    Max

  • Bug? Optional Crystal Parameters in InfoView if R3 is connected!

    Hi There,
    in another [thread|Re: Optional Crystal Parameters aren't optional in InfoView; we tested a lot with optional crystal parameters in InfoView. I created two similar reports, one is connected to oracle, the other is connected to SAP R3 Infosets and Tables. If i create an optional input-parameter with a standard-value for the report it works fine (and optional). I've also created a "if (hasvalue) then else condition" when the user deletes the standard value and does not enter a value then. Everything works perfect as long as a oracle database is connected.
    If i try to do the same connected to a R3 Table or a R3 Infoset, the parameter is not optional, the standard value is missing and due to this, i cannot test the  "if (hasvalue) then else condition" because i cannot run the report without a parameter.
    All this happens only in InfoView. If you run it directly in crystal, everything works fine...
    I think i've found a Bug.
    Colleagues told me that there should be similar problems when you try to connect a BW Query...
    Thanks
    Sebastian

    Is there anybody out there who can also test this issue ?
    Thanks
    Sebastian
    p.s. Please also check this Thread: [Re: Optional Crystal Parameters aren't optional in InfoView|Re: Optional Crystal Parameters aren't optional in InfoView]
    Edited by: smenzl on May 27, 2010 4:53 PM

  • Problem with empty report parameters when passed to PL/SQL function

    Hi,
    We have come across what appears to be a bug in the JRC. When passing a report parameter to a PL/SQL function as a parameter, empty parameters are changed before being sent to the function. More specifically, an empty string "" ends up as the value "(')" in the PL/SQL function parameter. In our report we print the report parameters on the first page so we know that the parameters are OK before being passed to the database.
    The problem exists for version 12.2.203, 12.2.204 and 12.2.205 of the JRC.
    We have identified a workaround, but it is not exactly elegant: Before executing the report we modify all empty  parameters ("") to " " . In the PL/SQL function, we trim all parameters before using them.
    We call the function using a command object with a sql syntax like this example:
    select * from table (qa_batch_release.get_qa_br('{?p_report_id}','{?p_reg_set_number}','{?p_cr_number}','{?p_change_id_decode}','{?p_country_id}','{?p_mfg_item_no}','{?p_4_no}','{?p_5_no}','{?p_7_no}'))
    The PL/SQL function is a table returning function.
    Best regards, Thor

    Hi Kishore,
    using #COLUMN_VALUE# would probably not make much sense, because normally a report has multiple columns and not just the numeric column which you want to verify if it's negative. But APEX will fire the template condition for each column, because the report template is a column cell template.
    What you can do to make it more generic is to use for example
    #CHECK_AMOUNT#
    in the template and provide a not displayed column in your SQL statement which contains your value which is named CHECK_AMOUNT. For example:
    SELECT NAME
         , BALANCE
         , BALANCE AS CHECK_AMOUNT
    FROM XXX;Because this CHECK_AMOUNT column would be a generic name, you can use this template in all your reports as long as you provide this column.
    Thope that helps
    Patrick

  • Question about function with in parameters

    Hello,
    I have a question about functions with in-parameters. In the HR schema, I need to get the minimum salary of the job_id that is mentioned as an in-parameter.
    this is what I am thinking but I dont know if it's correct or not or what should I do next!
    create or replace function get_minimum_salary (i_job_id in varchar2)
    return number
    as
    begin
    SELECT min_salary INTO min_sal
    FROM jobs
    where job_id = get_minimum_salary(xy);
    RETURN i_job_id;
    end get_minimum_salary;
    thanks in advance
    EDIT
    Thanks for your help all.
    Is it possible to add that if the i_job_id which is the in type parameter does not have a minimum salary then use the following function to register an error:
    create or replace procedure insert_error (i_error_code in number,
                                                      i_error_message in varchar2)
    as
    begin
    insert into error_table (error_user, error_date, error_code, error_message)
    values (user,sysdate,i_error_code,i_error_message);
    end insert_error;
    This function is basically to say that an error has occured and to register that error, at the same time I need to print out the error using the dbms_out.put_line.
    Any ideas of how to do that?
    Thanks again
    Edited by: Latvian83 on Jun 1, 2011 5:14 AM

    HI
    I have made little bit changes in ur code. try this
    create or replace function get_minimum_salary (i_job_id in varchar2)
    return number
    as
    v_Min_sal jobs.salary%type=0;---- Variable declaration
    begin
    SELECT min_salary INTO v_ min_sal
    FROM jobs
    where job_id = i_job_id;
    RETURN v_Min_sal;
    end get_minimum_salary;
    Regards
    Srikkanth.M

  • Function with incomplete parameters

    I create a function with many parameters
    and I call this function through my application
    but when I call function I must declare all parameter inside this function like
    ddd("a","b",0,0,0,0,0,0,0)
    is there a method let function set a default value for parameter if code didn't declare it

    You can send just few first parameters and the rest will be passed as false. If you need to pass, say, first and 7th parameter, then you put 6 commas between values, as there is no named parameters in VFP and all parameters are passed by position.
    For every expert, there is an equal and opposite expert. - Becker's Law
    My blog
    My TechNet articles

  • Oracle Function with out parameters

    Hi, I'm trying to access a stored function on an oracle server with 2 out parameters, 2 in parameters and an out ref cursor.
    PL/SQL looks like this
    nStatusCode OUT INTEGER,
    sStatusMsg OUT VARCHAR2,
    sUsrNr           IN VARCHAR2,
    sPassword           IN VARCHAR2,
    crsReturn OUT pck_cursor.retRecordSet
    I drag the function onto dataset designer and it successfully maps the results to the datatable, it maps datatypes for first out parameters to decimal and string.
    the method genearated for fill by looks like (out decimal?,out string,string, string, out object)
    problem is, everytime i try to call this function it gives me casting exceptions for the first 2 out parameters, for the decimal it's not specified in more detail. for the other one it says there was an exception casting from OracleString to string. If I change the PL/SQL function to leave the first 2 out parameters away it works fine. Do I manually need to change the TableAdapter definitions??

    Hi,
    I think I found the problem but not a good solution. It seems to be a problem with auto code generation for TableAdapters in the Dataset wizard. In the Parameter Definition for the Command I set DbType.Decimal and DbType.Sting for the SqlDbtype Property of the out params. The GetData and Fill Method is generated with Fill(out decimal? out1, out string out2). When I look in the generated code ith first sets the SqlDbtype as written but after this also the OracleDbtype to OracleDbType.Decimal and OracleDbType.Varchar2. The casting these types before returning the throws the exception. Any idea how to change this behavior?

  • How can I get "IMAQ Line Fit" stable (with the same points)

    How can I get "IMAQ Line Fit" stable (with the same points)
    I my vision applications I use a lot off times "IMAQ Line Fit"
    some times the results are not Stable.
    See vi and word document attached.
    When I take the same points but in a other order (sort)
    then suddenly all points are used.
    In this case I was looking for a edge in vertical direction (Y).
    I found the points but "IMAQ Line Fit" did not function well.
    I tried changing all settings like pixel radius and minimum score and
    also threshold and so on. But no result.
    Then I sorted the points reversed and that worked. See vi.
    I use labview Labview 8.6.0 and IMAQ machine vision.
    Maybe this problem is solved in a newer version.
    Please let me know.
    Thanks
    Attachments:
    TEST-imaq-line-fit-86.vi ‏169 KB
    IMAQ-Fit-Line-Problem-86.doc ‏230 KB

    Thank You for your reaction Hossein,
    This "one application" uses "Line fit" about 20 000 000 times a day.
    about 200 will go wrong. With your setting the the "Line fit" for this occasion will work but others will go wrong.
    A algorithm should be:
    1e Stable, when using the same points and settings the result MUST be the same. How the points are sorted should not matter.
    2e Accuracy
    3e Speed
    4e Testing. Is very difficult but al least close points and the same points and sorting ... should be done
    NI now as made a " IMAQ Line Fit" Problem CAR (Corrective Action request) 298016.
    so in the future there will be a update.
    In the mean while a made a line fit which uses Bisquare option from Linear Fit.vi :
      from C:\Program Files\National Instruments\LabVIEW 8.6\vi.lib\analysis\6fits.llb
    This is a temporary fix because "IMAQ Fit Line VI" is not so stable.
    Because outliers should be rejected only Bisquare does this reasonable.
    This program does NOT USE "Minimum Score" and "Pixel Radius"
    Valid fit = When there are enough points within Outlier_Distance.
    Algorithm steps:
    - Determine if line is more horizontal then vertical, Compare DeltaX with DeltaY
    - If DeltaX <= DeltaY then SWAP X Y and later Swap back
    - Sort Points at on X value
    - First : Bisquare Linear Fit
    - Calculate distances to the found line for all points
    - Inliers: Points within Outlier_distance
    - Outliers: Points outside Outlier_Distance
    - Only use Inlier Points
    - Check again if DeltaX < DeltaY then SWAP X Y later SWAP back again
    - Second : Bisquare Linear Fit only with the Inlier Points
    - Results are from the second fit
    Warning : This Program is Not so accurate and Not so fast
    See attachments it is in labview 8.6
    If some has a improvement please let me know.
    Thanks
    Attachments:
    svi_fit_line_Bsquare_and_draw.vi ‏18 KB
    Fit_Line_Bisquare_Linear.vi ‏40 KB

  • Trying to get Photoshop CS4 functional with Mavericks and an Epson 3880 printer. CS4 fails to send a file to the print queue. Have reinstalled the Epson 3880 driver for Mavericks. All looks good but no file is sent.

    rying to get Photoshop CS4 functional with Mavericks and an Epson 3880 printer. CS4 fails to send a file to the print queue. Have reinstalled the Epson 3880 driver for Mavericks. All looks good but no file is sent.
    Does anyone know how to fix this?

    What EXACT version of Photoshop CS4 are you running?  You should be on Photoshop CS4 v 11.0.2.
    Also run Apple's software update to see whether it offers you the latest Epson update:
    Printer Driver v9.33
    Epson Stylus Pro 3880, Drivers & Downloads - Technical Support - Epson America, Inc.
    MOST IMPORTANTLY:  have Photoshop re-create its own Preferences:
    To re-create the preferences files for Photoshop, start the application while holding down Ctrl+Alt+Shift (Windows) or Command+Option+Shift (Mac OS). Then, click Yes to the message, "Delete the Adobe Photoshop Settings file?"
    Note: If this process doesn't work for you while you're using a wireless (Bluetooth) keyboard, attach a wired keyboard and retry.
    Important: If you re-create the preferences by manually deleting the Adobe Photoshop CS6 Settings file, make sure that you only delete that file. If you delete the entire settings folder, you also delete any unsaved actions or presets.
    Reinstalling Photoshop does not remove the preferences file. Before reinstalling Photoshop, re-create your preferences.
    NEW Video! Julieanne Kost created a video that takes you through two ways of resetting your Photoshop preferences. The manual preference file removal method is between 0:00 - 5:05. The keyboard shortcut method is between 5:05 - 8:18. The video is located here:
    How to Reset Photoshop CS6’s Preferences File | The Complete Picture with Julieanne Kost | Adobe TV
    Mac OS
    Important: Apple made the user library folder hidden by default with the release of Mac OS X 10.7. If  you require access to files in the hidden library folder to perform Adobe-related troubleshooting, see How to access hidden user library files.

  • Function with more than one return value

    Hi
    Please let me know how to write a function with more than one return value and in what scenario should we go for this option.
    Thank you

    user12540019 wrote:
    Please let me know how to write a function with more than one return value and in what scenario should we go for this option.Yes. And the following is the correct approach (using OUT variables is not!) - you deal with the multiple values as a data structure. This example uses an custom (user-defined) SQL data type as the structure.
    SQL> create or replace type TXYcoord is object(
      2          x       number,                  
      3          y       number                   
      4  );                                       
      5  /                                        
    Type created.
    SQL>
    SQL>
    SQL> create or replace function fooCoordinate( someParam number ) return TXYCoord is
      2  begin                                                                         
      3          -- doing some kind of calculation using input parameters              
      4          --  etc..
      5
      6          -- returning the multiple return values as a proper data structure
      7          return(
      8                  TXYcoord( 0, 0 )
      9          );
    10  end;
    11  /
    Function created.
    SQL>
    SQL> -- selecting the data structure
    SQL> select
      2          sysdate,
      3          fooCoordinate(123)      as XY
      4  from       dual;
    SYSDATE             XY(X, Y)
    2010-02-01 08:49:23 TXYCOORD(0, 0)
    SQL>
    SQL> -- selecting the properties/fields of the data structure
    SQL> select
      2          sysdate,
      3          treat( fooCoordinate(123) as TXYcoord).x        as X,
      4          treat( fooCoordinate(123) as TXYcoord).y        as Y
      5  from       dual;
    SYSDATE                      X          Y
    2010-02-01 08:49:23          0          0
    SQL>

Maybe you are looking for

  • TAXINN document

    hi., i need fully TAXINN document.(from top to bottom configuration document) can u send to me ? Very Urgent.

  • SQL Developer Import Excel problem

    I just recently installed SQL Developer (1.1.3). I created a table with 4-columns all char datatype. I tried to import an excel file into this table. Checked Header Row )1st excel record is header) and move all Available columns into Selectedcolumns.

  • How to copy a document and paste in pdf form

    I have an email that I copied. I need to paste to a document in PDF form. Does any one know how I am to do this?

  • Open new tabs not working (cmd+T)

    after the most recent leopard security update (not really sure if that has anything to do with it though) safari has lost it's command+"T" ability to make new blank tabs. in fact not even firefox can do it. i'm very puzzled and no one on this forum o

  • How can you view an application to a car head unit

    how can you view an application to a car head unit ( example) is the Motion X GPS