Solving Riccati equation

I have experience with Systembuild only.
I saw that Xmath has a module with a function to solve the Riccati equation. How can I use this function in Systembuild?

The Riccati equation can be solved in SystemBuild using a UserCodeBlock where internally the function XmathExecute is called to solve the Riccatti equation using Xmath.
This Riccati equation solver could be placed in a slower periodic SuperBlock so that it is not recalculated every time step.
Another UserCodeBlock (file scoped with the Ricatti solver UserCodeBlock) could return the new A and B matricies.
But, the real problem is how to inject the new A and B matrix into your model.
The SystemBuild StateSpace block A,B,C and D matricies can be only changed during simulation initialization.
You would have to create your own StateSpace SuperBlock using the matrix multiple blocks, UserCodeBlock(returns new A,B), intergator block and summer blocks to calculate.
Xdot = Ax + Bu;
Y      = Cx + Du;
It would be much easier if there were a StateSpace block that had the A and B matricies as inputs.
Note: using SystemBuild the UserCodeBlocks and StateSpace SuperBlock dimensions are fixed and would have to be determined before hand.

Similar Messages

  • Help with solving Riccati Equation

    Hoping someone can help me out with solving this equation.  The continous algebraic riccati equation is set up in the form A'*X + X*A - X*B*X + Q.     There is a riccati solver in the control and simuation toolkit but the equation is set up as A'*X + X*A - [X*B + N]*inv(R)*[X*B + N]' + Q = 0.  Default for R is just the identtity matrix, and default for N is empty matrix so does this reduce to A'*X + X*A - X*B*B'*X + Q  ?  (Not 100% on that.)   So is there anyway to use labviews CD Continuous Algebraic Riccati Equations VI on my equation?
    Thanks so much for any help.

    I think you are correct.  I think that technically the last X is transposed, but since X is symetric X' = X, so it makes no difference.

  • Is there a limit on the size of the input for the Solve Linear Equations block?

    Hello,
    I'm trying to figure out why the Solve Linear Equations block will properly function with some sets of data and why it won't with others. What my program is doing is taking a signal and comparing it with a batch of sine and cosine waves to try and pick out patterns in the data. I have different sample sizes and it seems to work when I throw 3900 points at it. However, I have another set with 4550 points and it gives me incorrect amplitudes for my sinusoids.  Is there some limit to the size of the matrices that I can give this block? Or is there some other workaround that still allows me to keep all of my data?
    Thanks,
    David Joseph

    Well, the best way to show what I expect is to see the entire program. It's pretty evident that when looking at the graphs, something isn't right. What is supposed to happen is that the runout amplitudes are found, and then those sinusoids are subtracted from the initial data, leaving tooth to tooth data and noise. When I use the larger arrays, it seems as though not all of the data gets through (count the peaks on the product gear runout graph vs. initial) and the amplitudes are much to small, such that nothing is really taken out and the tooth to tooth data looks like the initial data.
    Also, we will also be using an FFT, but it will be limited to only determining the frequencies we should check. I've fought with the fft blocks quite a bit and I just prefer to not use them. Plus, the guy I'm writing this for wants exact answers and does not want to pad or resample the data or use windows.
    The exact number of data points isn't important (ie. 4550 vs 4551) since I use the array size block to index the for loop.
    As for typical values, they can change a lot based on materials. But, the original 3900 data point sets and the 4550 data point sets used practically identical gears. So, use the original 3900 sets I've included as references (check the RO array block numbers to compare).
    I've included 3 3900 samples, 3 4550 samples, and 3 4550 samples that have been truncated to 3900 or so as constants on the block diagram.
    Also, the check for additional runouts (like 3 per rev, 4 per rev, etc..) is optional, but if you choose to use it, use positive integers only.
    I don't know how much of this program will make sense and I have wires running everywhere.. so good luck. Keep in mind I'm only a student and I hadn't touched Labview until about 2 or 3 months ago.
    Thanks,
    David Joseph
    Attachments:
    Full example.vi ‏139 KB

  • Solving differential equations

    I m working on a project of fluids and i wannu use java programming for solving various equations..please teel me how to solve differential equation using java(partial diffential equations and integration also).thanx

    Hi!!
    Thanx for ur reply...but I have seen a program on net called JMatLink...which uses JAVA program to opens MATLAB and get the result from MATLAB and show it on its on GUI.I dont know the exact structure but i suggest u to check it and tell me how it works if u know.Sorry for bothering u again and again...but i need it badly for my project.
    explore the following link.
    http://www.held-mueller.de/JMatLink/
    Thanx

  • Solving Differential Equation - getting strange results.

    Hi, i am using LabView to model the mathematic pendulum which comes down to solving the quation numericaly:
    where w is constant and 0 is an angle between the pendulum's cord and the vertical which i want to plot against time. I built this very simple model to solve this equation (this is what our teacher showed us) [x is the angle]
    and this is what i get:
    "fi" is the starting angle. The result is a cosine , as it is to be expected, with the right period, but why the amplitude is so low? Am i missing something here? No matter how i change the initial value, the amplitude is always 5 oders of magnitude lower. It wouldnt be a problem, since what we are required is to solve the equation, but when i want to factor that in the equation above 0 should be sin0 , the problem arises - sinx for so low x , is...x. So my questions are:
    - am i setting the initial conditions wrong?
    - has the value of dt anything to do with it?
    - is the method correct?
    - am i clueless? 
    A week ago i had no idea what LabView is. We were all thrown into the deep water, we were shown the method, but were not teached how the LabView works,so please, be kind.
    Thank You in advance .
    Attachments:
    pendulum.vi ‏14 KB

    Hello;
    Noise is a difficult issue to advise about.
    There are some things you can try, but the result will depend on different factors, such as, environment, lenght of cables, equipment on vicinity, etc.
    Anyways, you can try to hook up a BIAS resistor in between the ch- and AIGND on your BNC device. That resistor will bleed out the common voltage current and help on noise balancing. Another thing you can try is to hook up a simple RC low pass filter at the analog input. That might help to get rid of that noise.
    I'm also attaching an App Note that talks about Noise and some ways to get around it.
    Hope this helps.
    Filipe A.
    Applications Engineer
    National Instruments
    Attachments:
    Field_Wiring_and_Noise_Considerations.zip ‏196 KB

  • Solving Cubic equation

    Hello!
    I am trying to create an applet which solves cubic equations. I have managed to create the layout
    but the maths is causing problems. Well, I am a newbie and don't know much yet.
    Here's what I've done so far:
    import java.awt.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    public class CubicEquation extends java.applet.Applet implements ActionListener
      TextField aTxt, bTxt, cTxt, dTxt;
      int a, b, c, d;
      double f, g, h;
      Button graphBtn;
      int size = 750;
      public void init()
        setLayout(null);
        resize(1000, 800);
        Label Albl = new Label("a:");
        Albl.setBounds(780, 40, 15, 20);
        Label Blbl = new Label("b:");
        Blbl.setBounds(780, 70, 15, 20);
        Label Clbl = new Label("c:");
        Clbl.setBounds(780, 100, 15, 20);
        Label Dlbl = new Label("d:");
        Dlbl.setBounds(780, 130, 15, 20);
        Label Rlbl = new Label("Range:");
        Rlbl.setBounds(760, 170, 45, 20);
        aTxt = new TextField();
        aTxt.setBounds(800, 40, 80, 20);
        bTxt = new TextField();
        bTxt.setBounds(800, 70, 80, 20);
        cTxt = new TextField();
        cTxt.setBounds(800, 100, 80, 20);
        dTxt = new TextField();
        dTxt.setBounds(800, 130, 80, 20);
        graphBtn = new Button("Graph it");
        graphBtn.setBounds(810, 250, 55, 20);
        add(Albl);
        add(aTxt);
        aTxt.addActionListener(this);
        add(Blbl);
        add(bTxt);
        bTxt.addActionListener(this);
        add(Clbl);
        add(cTxt);
        cTxt.addActionListener(this);
        add(Dlbl);
        add(dTxt);
        dTxt.addActionListener(this);
        add(Rlbl);
        add(graphBtn);
        graphBtn.addActionListener(this);
        public void displayGraph(Graphics g)
          g.setColor(Color.cyan);
          for (int y = 0; y <= size; y = y + 10)            //Draw Grid//
            g.drawLine(1, y, size, y);
          for (int x = 0; x <= size; x = x + 10)
            g.drawLine(x, 1, x, size);
          g.setColor(Color.black);
          g.drawLine(size / 2, 0, size / 2, size);
          for (int i = 0; i <= size; i = i + 20)            //Draw y axis//
            g.drawLine(size / 2 - 5, i, size / 2 + 5, i);
         g.setColor(Color.black);
         g.drawLine(0, size / 2, size, size / 2);
         for (int j = 0; j <= size; j = j + 20)             //Draw x axis//
           g.drawLine(j, size / 2 - 5, j, size / 2 + 5);
      public void paint(Graphics g)
       f = ((3*c/a) - (b*b/a*a)) / 3;
       g = ((2*(b*b*b)) / (a*a*a)) - ((9*b*c)/(a*a)) + (27*d)/a)) / 27;
       h = ((g*g)/4) + (f*f*f)/27;
    public void actionPerformed(ActionEvent e) {
           if (e.getSource() == graphBtn) {
           a = Double.valueOf(aTxt.getText()).intValue();
           b = Double.valueOf(bTxt.getText()).intValue();
           c = Double.valueOf(cTxt.getText()).intValue();
           d = Double.valueOf(dTxt.getText()).intValue();
           if (aTxt.getText().equals("")) {
                a = 0;
           repaint();
    }Can anyone help please?

    The easiest + best way by far to solve polynomial problems is to use matrices.
    Search around on the web and see if you can find a matrix package - I think NASA had an open source free one; you might want to see if you can find that.
    Given
    |a b c|       |x|
    |d e f|    =  |y|
    |g h i|        |z|
    there is a formula that uses determinants somehow that finds the values of all the variables

  • How do I solve simultaneous equation with 3 unknowns ?

    I need to solve simultaneous equations with 3 unknowns . Can any body help out on how to go about this? Thanx.

    You did not specify what kind of equations you have....
    Are your equations linear? Check the linear algebra palette and a look at "solve linear equations:.
    LabVIEW Champion . Do more with less code and in less time .

  • Solve Linear Equations NaN return

    I've implemented a modified Linear Levenberg Marquardt function for gauss fitting of spectral data, but have problems from time to time where I simply can't fit a specific data set.
    I've traced the problem to the function "Solve Linear Equations" outputting NaN for one or more solution vectors (Not all) which then plays havok with my function.
    I've located a data set which is initially OK, but which after solving the linear equations has NaN as the second element of the solution vector array. Changing the matrix type to something other than "generic" gets rid of the NaN for this particular data set, but gives problems with others which work with the "generic" matrix type.
    Since my mathematics lectures in college are a few years away now, I'm asking someone out there if they can help me with my problem. I can supply a "corrupting" data set if this would help, or maybe someone knows this problem and has a work-around?
    I've thought of leaving the matrix type to "generic" and checking the output to see if there's a NaN present, and if so, then re-calculate with another matrix type until there's no NaN. This is most likely not very sound mathematically, but it might reduce the number of rogue data sets.
    Thanks in advance
    Shane.
    Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)

    Hi Altenbach,
    The data can have a significant amount of overlap. Typically three to four groups of peaks fully resolved, but each group can have up to 4-5 peaks in them, partially visible only as shoulders.
    The start value "problem" is more or less solved (but as usual, not yet finished).
    I've got an approximate first-guess peak find running which does a pretty good job of finding the peaks I need, and I then fit the height and FWHM first before doing a full optimisation (The Sub-VI approach allows much more flexible fitting models).
    The fitting works well on almost all data sets. There are simply some spectra which (although visibly hardly different to others which work perfectly) do not fit, i.e. generate the NaN response from the "solve linear equations" function. It's a numeric problem (bug?), I'm sure, and not strictly a peak location or resolution problem. then again, I may be wrong.
    I refer to the standard "LevMar" VI as being linear, because it assumes a linear relationship between the variable variation and the end mse used for optimisation. This is where the "Solve linear Equations" comes in. Since the relationship is almost certainly not linear (foe example when peaks overlap), I thought maybe the non-linear coefficient guess may yield better results. I've had a quick look through the non-linear LEV-MAR function, but don't understand it yet ot the extent I understand the linear one. It does indeed seem to take a slightly different approach (once you look past the whole parsing code of the "linear" function.
    I'll need some time to get some understanding of the non-linear code.
    Attached are some example spectra (One which works, and one which doesn't).
    Thanks again
    Shane
    Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
    Attachments:
    Spectra.zip ‏3 KB

  • Solve 'String Equation' at the run time

    Can any one help me how to solve String Equation. I get equation and its respective values from database table and i want to solve the equation at run time.
    Ex: (round (x * y) / 1000) /1000
    Please help me as i am new to Java envionment.
    Thanks
    Raveesh

    For a small footprint Java interpreter have a look at BeanShell.
    kind regards,
    Jos

  • How to solve this equation?

    can anybody help me, solve this problem in as3 ?
    x+y+z=8000;
    0.17*x + 0.35*y +0.08*z =960
    thanks very much!!!

    this gives a little more explanation, although doesn't actually complete for me there are too many permitations
    you are also going to have to worry about the number representation issue using floating points numbers
    it might be better to convert the second equations to something equivalent which uses ints
    package
              import flash.display.Sprite;
              public class Main extends Sprite
                        //x+y+z=8000;
                        //0.17 * x + 0.35 * y +0.08 * z = 960
                        public function Main()
                                  // consider each equation in the form a.x + b.y + c.z = d
                                  // we have 3 unknowns x, y, z so we need 3 nested for loops to run over all possibilities
                                  // then the maximum value x can be is d/a
                                  // maximum y = d/b
                                  // maximum z = d/c
                                  // now if we have 2 equations we need to take the maximum for each known from either equation
                                  // so in your case with maximum x is the maximum of 8000/1 and 960/0.17 =
                                  // maximum y is the maximum of 8000/1 and 960/0.35
                                  // maximum z is the maximum of 8000/1 and 960/0.08
                                  // all these maximums should be rounded down to the nearest integer
                                  //max x = 8000
                                  //max y = 8000
                                  //max z = 12000
                                  //we use these maximum values for the nested for loop limits
                                  var maxX:int = Math.max(8000 / 1, 960 / 0.17);
                                  var maxY:int = Math.max(8000 / 1, 960 / 0.35);
                                  var maxZ:int = Math.max(8000 / 1, 960 / 0.08);
                                  trace("max values: ", maxX, maxY, maxZ);
                                  for (var i:int = 0; i < maxX; i++)
                                            for (var j:int = 0; j < maxY; j++)
                                                      for (var k:int = 0; k < maxZ; k++)
                                                                // this if statement is a representation of if the values for x, y and z we are trying
                                                                // actually solve the equations
                                                                // so in your case use the following
                                                                if ((i + j + k == 8000) && (0.17*i + 0.35*j + 0.08*k) == 960)
                                                                          trace("x=", i, ", y=", j, ", z=", k);
                                  trace("done");

  • Solve linear equations vs pseudoinverse memory issues

    Hello,
    I am trying to solve a Ax
    = b system, and have setup my algorithm to use the LU decomposition
    followed by the appropriate use of the "Solve Linear Equations" VI. I
    then check the error output from this VI, and if there is an error I
    try using the "PseudoInverse Matrix" VI.
    I am doing this in a loop with a progressively larger matrix for each iteration.
    This
    works great EXCEPT for when my algorithm gets close to the maximum
    memory allowed (i.e. - the iteration BEFORE I get an error message
    stating that the VI has run out of memory).Then, although I do NOT get
    an error code from my "PseudoInverse Matrix" VI, the values output from
    this VI are complete garbage (really really large values).
    Has
    anyone come across a similar issue before? Is there a way around this?
    i.e. - I would like to know when/if the  "PseudoInverse Matrix" VI will
    not provide valuable data output so I can stop my algorithm the
    iteration beforehand.
    Thanks!

    Zamjir,
            Can you post the VI and the matrix needed to replicate the issue? I didn't find any other instances of this happening but that doesn't mean that it's not expected. I understand that things ramp up in memory and just before it tops out it shows large (not correct) values but I don't know if this is expected and is just LabVIEW's way of letting us know that it's about to error out (in case you wanted to build in a shut down program you could base it off of these large values) or if it is a bug. If you could post the code so I can take a look at it and also a screenshot of the "out of memory" error you see, I will see what I can find out for you. 
    Grant H.
    National Instruments
    LabVIEW Product Marketing Manager

  • Can labview solve this equation?

    Hello,
    I need to solve this equation in labview to t. X and Y are known values.
    And if this part can't be larger then 1. If it is, it should be made 1.
    I have really no idea where to begin to solve this problem.
    Thanks in advance!

    If you are actually trying to solve it recursively, then Newton's Method should work.
    Actually after checking it, it's obvious the that any value of t at the
    input will give you the correct value of t at the output.
    Message Edited by rpursley8 on 11-21-2005 12:09 PM
    Randall Pursley

  • Solving functional equation and or evaluating non-linear equations

    Does anyone know of a computer program that will do either or preferably both of the following:
    1: a functional equation; e.g. 4x^2exp(-1/1-x^2) -6x = 0;
    2: Evaluate a function at specified points; e.g. what is the value at -.5 of the above expression.
    i imagine excels solver does the second but I didn't load solver when I loaded excel.
    I'm not too proud to accept solutions as well. Many thanks.

    Is it what you wanted ?
    In cells of column B, the formula is :
    =IFERROR(INDIRECT(ADDRESS(1,2,,,A&" "&$A$1)),"")
    Between the late double quotes I insreted the character INFINITY ($221E)
    Yvan KOENIG (VALLAURIS, France) mercredi 21 avril 2010 20:44:36

  • Solving nonlinear equation with VI

    Hi,
    I want to use LabView to solve a nonlinear equation. I read forums and figured out that I can use Nonlinear System Solver. vi and I noticed there are two options to write the equation: 1) F(X) is formula and 2) F(X) is VI. I could use the first option and write the equation with that but I did not understand how to use a sub-Vi to provide the equation. Would any one please tell me how to do that?
    Thank you 

    Soran,
    Read the detailed help for the solver VI. 
    The VI usually executes much faster than the formula parser/evaluator. Since solvers (and curve fitters, which have the same options) may need to evaluate the function many times while solving, that time can become significant.
    In the help is a link to a template for the VI you need. You must use the exact connector pane and reference type. While you can create your own VI, it is much easier to use the template. On the block diagram create the code to generate your equation values in the configuration required by the solver. Be careful to put the parameters in the correcto order.
    Lynn

  • How to solve an equation which has integration

    Dear Sir,
    I need to implement an equation as below:
    I have checked many VI's from Mathematics and signal processing tool box but unable to fulfill my requirement. Kindly help me out with any suggestions.
    with regards,
    Sri
    Solved!
    Go to Solution.

    This is not an equation, because there is no equal sign.
    What do you mean by "solve"?
    What do you mean by "implement"?
    What parts are known, what are the unknowns?
    Are you looking for a symbolic math solution?
    Your probably shoud try to give significantly more information. What problem are you trying to solve? Where is the data coming from? How are the results used?
    LabVIEW Champion . Do more with less code and in less time .

Maybe you are looking for

  • How to get the folder name of selected subitem in tree structure?

    Hi All,            I created a tree structure like below.          ->Folder1-- 1                           2                           3         ->Folder2-----1                            2                            3                 i.e i have two

  • Presence status from iMessage not shown in Mail since Mavericks upgrade

    I'm re-posting this in the Mail folder, maybe somebody here knows the answer: https://discussions.apple.com/message/24928633#24928633

  • Problem while using oracle.sql.CLOB

    Hello, I was trying to use oracle.sql.CLOB to update CLOB types in database. I was able to successfully run the update when I use the connection obtained from normal DriverManager.getConnection method. But have issues when I use a datasource lookup,

  • Why does Pan and Zoom mess up my timeline

    Please forgive my ignorance as I am relatively new to this. I just about have a finished video which include video clips and still images. I just went to add a Pan and Zoom effect to a still image and when I hit done it messed up my timeline - See be

  • Cursor problem inside a JInternalFrame

    Hi Everyone, I encountered a strange problem working with JInternalFrames. The cursor doesn't change to a resize cursor when it should (for example when resizing a JSplitPane or a JTable inside a JInternalFrame). On the main Frame everything just wor