Linear equation problem

Here is the problem:
I have 2 point A(x1,y1) & B(x2,y2) ,what i need is find a point C(x3,y3);
This point C should :
1)form a line AC that goes throught point B
2)C is intersectin point of the line AC & one of screen edges :
(left=0,right=ScreenWidht,top=0,bottom=ScreenHeight)
3) The C point form a line (vector?) A--->C & not C--->A
I need to fighure out the C ,so if A is a projectile source,the projectil
will fallow the Target (C point) from A---->C..
Hope that clear enought,i would realy appreciate if i get some help soling this math problem (im not good in math) , that will be great if i get some code ( routine that takes x1,y1,x2,y2 as parametres and calcule x3 and y3)
Thanks.

Here is the problem:
I have 2 point A(x1,y1) & B(x2,y2) ,what i need is find a point C(x3,y3);
This point C should :
1)form a line AC that goes throught point B
2)C is intersectin point of the line AC & one of screen edges :
(left=0,right=ScreenWidht,top=0,bottom=ScreenHeight)
3) The C point form a line (vector?) A--->C & not C--->A
I need to fighure out the C ,so if A is a projectile source,the projectil
will fallow the Target (C point) from A---->C..
Hope that clear enought,i would realy appreciate if i get some help soling this math problem (im not good in math) , that will be great if i get some code ( routine that takes x1,y1,x2,y2 as parametres and calcule x3 and y3)
Thanks.

Similar Messages

  • 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

  • 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

  • Is there a linear equations VI thatI can use for inputting the coefficients with variables attached to them? Thank you.

    Is there a linear equation VI that I can use for inputting the coefficients with variables attached to them? I am currently studying elec engineering and am in the thick of transient analysis. It is very time consuming figuring the mesh and nodal analysis in the transform domain. With 3 branches in a mesh analysis the resistors, inductors and capacitors are represented with variable s in them. I need to determine in the transform domain then convert to the time domain. One equation goes like this: (3+2s+1/4s)i1s - (2s)i2s - (1/4s)i3s = 6/s -6. The other equations are similar. I must keep the variable s in the equation and solve it with s in the result. I made several VIs for determining simultaneous linear equations some for complex numbers and they work great. This one has me a little stumped. I thinking that maybe Labview doesn't have a VI for this. The other VIs were fine because you just plugged in the numbers and ran the VI and got your result. Any VIs that do LaPlace transform operations?
    Thank you.
    Tom

    Hello Tom,
    You can find a VI for doing Laplace transforms in Functions->Analyze->Signal Processing->Frequency Domain (this VI is only available in the Full and Professional versions).
    You may also find the following tutorial of help in working with linear systems in LabVIEW.
    Linear Systems in LabVIEW
    Keep up to date on the latest PXI news at twitter.com/pxi

  • Linear Equation in SAP

    Hi Gurus,
    I got a requirement to develop Simulator Process in which we are using Linear Equation for solving.
    Linear Equation is wat we studied in School days...
    3x + 2y + 7z = 20.  (meaning: 20 is my target.. i want to know how much of x, y, z is added to achieve my target)
    5x + 6y + 6z = 50.
    6x + 2y + 2z = 10.
    i want to know the values of x, y, z(this variable will be up to 10 also).
    I know to solve manually.
    Can you tell me is ther any function module to acheive this...
    Or any easy way to develop in SAP?????
    Thanks n Regards
    Aravindh Mani

    Hi,
    I dont think there is a standard FM for this. You can better try to code the logic manually for this.
    Regards,
    Vik

  • Simultaneous linear equation solving

    I'm trying to solve some ill-conditioned simultaneous linear equations for a graphics application. Gaussian elimination using total pivoting on doubles isn't accurate enough. Does anyone know any better techniques?

    yeah, that's pretty good. you might also try some numerical algorithms though if your system is sparse or you want a better performance if your system is large. nist website has a list i think.

  • How can I solve a system of linear equations for the non trivial solution?

    I want to solve the equation A Q =0 where A is a 1xn matrix and Q is an nxn matrix for A. I tried using the Solve Linear Equations sub.vi but it just gave me the trivial solution. What can I do to solve this?

    Larry of KochLab,
    Have you looked at the MathScript Node? Would it be possible to post a simple example of what you are trying to do?
    Ben Sisney
    FlexRIO V&V Engineer
    National Instruments

  • 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

  • Best fit/ linear equation in Numbers on the IPad?

    Does anyone know how to find the best fit line equation on Numbers for the IPad? I know how to find it in IWork for the MacBook and how to find the line on the Ipad. Thanks

    Can you tell me where line of best fit is in the iOS version? I havent seen it yet.
    You can search on the Internet for the linear regression formul, and compute the equation yourself. Then you could plot that series of points on your chart to show the line if it is not part of iOS.
    Jason

  • Non-linear equation solution

    I have used Lev-Mar Non-Linear VI before but cannot understand how to apply to the following:
    deltaTC = R(TC)*L^2 + QS + QC(TC) +QR(TC)*dt
    where variables containing (TC) are dependent on TC.
    I have samples of change of L over time (dt).  Trying to determine dTC with variables dependent on TC (current value - which means initial T + dTC).
    Any help much appreciated.

    Hi Battler,
    I am not sure if you know this or not but Lev-Mar Non-Linear VI is not supported any more. Instead you can use Nonlinear Curve Fit.vi . It is located in function->mathematics->fitting palette.
    The functionality of both of them is the same.Next you can go LabVIEW help, search for this VI, and then look at the "Linear, Exp, and Power Fitting VI: labview\examples\math\curvefit.llb"
    example. On the block diagram go to "Time out"and "true" for the case structures.You will see the Nonlinear Curve fit.vi, you need to input your equation to the reference terminal f(x,a). So
    you need to make a subVI of your equation, and input it into f(x,a). Hope this helps!!
    Edna
    National Instruments
    Applications Engineer

  • Linear interpolation problem of array

    hello evryone!a little problem catch me ,iwant to replace the value of array  by  Linear interpolation.  i wii attach my vi ,when you haven seen it ,you wii understand what i mean.thank you ,good luck for you !
    Attachments:
    Linear interpolation.vi ‏19 KB

    No, I don't understand what you mean, even after looking at your code.
    There is an array labeled "want". Which of the outputs do you want to look like that and how does it relate to the current default input?
    LabVIEW Champion . Do more with less code and in less time .

  • Equation problem

    I have a nice little equation for drawing a pie chart.
    Problem is when I get up to around 20 pie slices I lose 1 degree in the rounding off of the numbers which results in an unclosed pie chart.( sloppy looking).
    Take a look at the equation and maybe suggest alternatives.
    int startAngle = 0;
    int currAngle = 0;
    int pieSize = Math.min(screenW,screenH)*3/5;
    g2.translate(Math.min(screenW,screenH)/6,(Math.min(screenW, screenH)/6));
    for (int i = 0; i <= answerList.size(); i++){ 
          float wedge = (float)TotalOutput[i+1]/numberOfAnswers;
          Color wedgeColor = myColor(i);
          currAngle = (int)Math.round(wedge * 360);
          System.out.println( currAngle );// adds up to 359 w/20 answers
          Arc2D arc = new Arc2D.Double(0,0,pieSize,pieSize,startAngle,currAngle,Arc2D.PIE);
          g2.setStroke(new BasicStroke(1f));
          g2.setPaint(new GradientPaint(arc.getStartPoint(),wedgeColor,arc.getEndPoint(),wedgeColor.darker()));
          g2.fill(arc);
          startAngle+= currAngle;// get new start point for pie slice
               } //forThanks
    Jim

    If you aren't too worried about the accuracy, just make the last item take up the rest of the space available. Have you tried using double rather than float? Or even BigDecimal?

  • Solving Coefficien​ts for Non-Linear Equation

    I have the following equation that I need to solve a, b and c. y = a+bexp(-x/c). Is there a VI that is written to help me?

    i don't understand what do you suppose to mean?
    you have not a,b and c values and you wanna solve 3 unknown variables with just one equation?
    do you think is that possible?
    even you had x and y values!
    but if you have 4 values and you just want to find another variables value it's so easy
    you can easily use a formula node.
    i have write a simple program for you to solve this equation and i attached it to this answer.
    it's with LabVIEW 5.
    Attachments:
    formula_node_example.vi ‏25 KB

  • 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

  • Percentage equation problem

    Which is the following:
         int a = 51;
                   int b = 60;
                   int total = a / b * 100;giving me 0 the answer should be 69

    Oh i see.
    One more question... I'm having trouble rounding it off:
    double a = 600;
                   double b = 814;
    double percent = a / b * 100;
    DecimalFormat decimalFormat = new DecimalFormat("##.#");
    decimalFormat.format(percentage);
    gives me:
    73.7
    but i want a percentage sign at the end it gives me
    7371% :|
    Obviously i could add a percentage sign at the end (after decimal format has run) how i originally had it but that defeats the purpose of using deceimal format.

Maybe you are looking for