Signal Algorithm help

I have two signals.  
Signal 1: 0-5V trigger signal.  During the time duration of interest, the trigger will go high 4 times for 1ms each.  In my software, I need to find the last trigger, which I can do easily.
Signal 2: From about 0 to 30ms, the signal is noise with level +- 40mV.  From about 30ms and up, the signal is noise with level +-5mV.  
I am suposed to find the time dfference between when the last trigger of signal 1 occurs and when signal 2 becomes +-5mV. 
I tried to do this by flipping the two signal arrays and find the elements in the arrays where specified thresheds are crossed.  Of course, the threshold for signal one is dffierent than signal 2.  The described approach only works 50% of the times.  The method fails when ignal 2 has spikes during the +-5mV period, which occurs once in a while.  
Any inputs on algorithm?  Thanks!  See attached for a pictorial explaination
Kudos and Accepted as Solution are welcome!
Attachments:
signal.PNG ‏41 KB

Attached is my attempt at the problem.  I introduced a guard band on my search.  I only ran a few test cases, and I will try it out tomorrow.  If you have better ideas, let me know.  Thanks!
Kudos and Accepted as Solution are welcome!
Attachments:
signalsearch.PNG ‏1379 KB

Similar Messages

  • Need algorithm help

    I need some help with my 3 class hangman program.
    whenever the program is run, it doesn't function as intended when a letter is entered. Any advice is greatly appreciated.
    Here's what I have so far:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    //<applet code="Hangman.class" width=400 height=400>
    //</applet>
    public class Hangman extends JApplet implements ActionListener
         private final int WIDTH = 400;
         private final int HEIGHT = 400;
         private JPanel panel,tools;
         private JLabel inputLabel;
         private Hang drawing;
         private JTextField guess;
         RandomWord t = new RandomWord();
         public String answer = t.getWord();
         public void init()
              tools = new JPanel();
              tools.setLayout(new BoxLayout(tools,BoxLayout.X_AXIS));
              tools.setBackground(Color.yellow);
              tools.setOpaque(true);
              guess = new JTextField(1);
              guess.addActionListener(this);
              inputLabel = new JLabel("Enter Guess:");
              tools.add(inputLabel);
              tools.add(guess);
              drawing = new Hang();
              panel = new JPanel();
              panel.add(tools);
              panel.add(drawing);
              getContentPane().add(panel);
              setSize(WIDTH,HEIGHT);
         public void actionPerformed(ActionEvent event)
              String g = guess.getText();
              int incorr = 0;
              int c = 0;
              int i;
              for(i = 0;i<answer.length();i++)
                   if((answer.substring(i,i+1)).equals(g))
                        c++;
                        drawing.setLetter(i,g);
              if(c == 0)
                   incorr++;
                   drawing.setIndex(incorr);
              repaint();
    // class number 2:
    import java.awt.*;
    import javax.swing.JPanel;
    public class Hang extends JPanel
         private final int PAN_HEI = 400;
         private final int PAN_WID = 400;
         private int index;
         private int posNum,corr = 0;
         private String print;
         public Hang()
              setBackground(Color.black);
              setPreferredSize(new Dimension(PAN_WID,PAN_HEI));
         public void setIndex(int v)
              index = v;
         public void setLetter(int y,String s)
              print = s;
              posNum = y + 1;
         public void drawBase(Graphics page)
              setBackground(Color.white);
              page.setColor(Color.black);
              page.fillRect(0,350,150,50);// base
              page.fillRect(0,150,25,200);
              page.fillRect(0,125,100,25);
              page.setColor(Color.gray);
              page.fillRect(84,125,7,50);// rope
              page.setColor(Color.black);
              page.drawOval(75,175,24,25);// head
              page.drawLine(250,55,255,55);
              page.drawLine(260,55,265,55);
              page.drawLine(270,55,275,55);
              page.drawLine(280,55,285,55);     
              page.drawLine(290,55,295,55);
              page.drawLine(300,55,305,55);
              page.drawLine(310,55,315,55);
         public void paintComponent(Graphics page)
              super.paintComponent(page);
              this.drawBase(page);
              if(index == 1)
                   page.drawLine(84,200,84,250);
              if(index == 2)
                   page.drawLine(84,215,34,175);
              if(index == 3)
                   page.drawLine(84,215,116,175);
              if(index == 4)
                   page.drawLine(84,250,50,300);
              if(index == 5)
                   page.drawLine(84,250,100,300);
                   page.drawString("You Lose",250,75);
              if(posNum == 1)
                   corr++;
                   page.drawString(print,250,50);
              if(posNum == 2)
                   corr++;
                   page.drawString(print,260,50);
              if(posNum == 3)
                   corr++;
                   page.drawString(print,270,50);
              if(posNum == 4)
                   corr++;
                   page.drawString(print,280,50);
              if(posNum == 5)
                   corr++;
                   page.drawString(print,290,50);
              if(posNum == 6)
                   corr++;
                   page.drawString(print,300,50);
              if(posNum == 7)
                   corr++;
                   page.drawString(print,310,50);
              if(corr == 7)
                   page.drawString("You Win",250,75);
    //last class :
    import java.util.Random;
    public class RandomWord
         Random g = new Random();
         String w1;
         String w2;
         String w3;
         String w4;
         String w5;
         String w6;
         String w7;
         String w8;
         public RandomWord()
              w1 = "freedom";
              w2 = "justice";
              w3 = "impulse";
              w4 = "destiny";
              w5 = "celsius";
              w6 = "ignited";
              w7 = "believe";
              w8 = "realize";
         public String getWord()
              String x = " ";
              int a = g.nextInt(6);
              if(a == 0) x = w1;
              if(a == 1) x =  w2;
              if(a == 2) x =  w3;
              if(a == 3) x = w4;
              if(a == 4) x = w5;
              if(a == 5) x = w6;
              if(a == 6) x = w7;
              if(a == 7) x = w8;
              return x;
    }I'm a very inexperiencd programmer as you can see.

    Darn, I thought you actually needed algorithm help. But instead all I see is:
    "Here's all my code. It doesn't work right. Let me plop it onto your virtual desk and ask that you just fix it for me. I'm going shopping (or whatever) and will be back soon."

  • Color Picker scripting or Levels algorithm help

    First question is: Does anyone know of a good explanation of the Levels algorithm as in how each setting affects a pixel in an image. If I change the midpoint of the levels, how would a specific pixel change in relation to that? I've been experimenting for hours and can't figure a common factor other than it seems to be a binary type relationship. The reason I ask this is because I'm trying to script something that will balance colors.
    If that method isn't practical, I can go to the old fashioned trial and error method but this way also presents a roadblock to me. I set a color picker point and the script can obtain the values from that point exactly as it is in the Info panel. If I put a levels adjustment layer over top and adjust it, I now see the original color value and the adjusted color value in the Info panel, but I can't figure out how to obtain the adjusted value with a script. It still returns the original value. Does anyone know a way to obtain the adjusted value?
    I hope I explained this right.

    Thanks, Michael.
    I'll have to look through that post on ps-scripts.com in more detail. That might be what I need.
    This little snippet you wrote:
    Michael L Hale wrote:
    This thread may help with the levels part. http://ps-scripts.com/bb/viewtopic.php?t=2498
    As for the adjustment layer you need to get the color twice. Once with the adjustment layer visible then again with it not visible.
    var csColor = activeDocument.colorSamplers[0].color;
    activeDocument.layers.getByName('Levels').visible = false;
    var csColor2 = activeDocument.colorSamplers[0].color;
    alert( csColor2.rgb.red + " : " + csColor.rgb.red );
    doesn't get me the before and after values. Example: The point I selected has a red value of 226. I added a Levels adj layer on top and moved the midpoint so the red value at that point (adjusted) was 234. I ran your code and it came back with 225.591439688716 : 225.591439688716. It isn't showing the adjusted value of that point.

  • BGP decision algorithm - help needed - stumped

    Hello gurus!  hoping for a BGP expert to chime in here. Im studying for my CCIE, and there is something in Jeff Doyle's Routing TCP/IP vol2 book that I just cant seem to figure out and its really stalling my understanding of the BGP path selection algorithm.  
    Its on pg 195, example 3-57, attached as an image in this post (Ive also attached the network diagram that this output refers to). Basically its an output of "show ip bgp" and whats stumping me is simply: for the aggregate route 192.168.192.0/21, why has this router selected as best (>) the one via next hop 192.168.1.254?? I would have thought based on the presence of the LocalPref = 100 on the 192.168.1.237 route that would have been selected.  But apparently not! Heres a walk through of the path selection logic as i understand it:
    1/WEIGHT: both 0, so skipped. 
    2/LOCAL_PREF: this is my problem, .237 should win, but ignoring for now...
    3/ORIGINATED LOCALLY: neither are they are learnt from BGP peers, so skipping.
    4/AS_PATH: both identical, AS100 only, so skipping
    5/ORIGIN CODE: both are 'i' (IGP), both were created from "aggregate-address" statements on their originating routers downstream in AS100
    6/MED: both empty, so skipping
    7/PREFER [eBGP] over [confedBGP] over iBGP: so the .254 route apparently wins on this condition... which in isolation, i agree with (clearly the eBGP .254 route is better than the .237 iBGP candidate).
    .... however what about step 2/LOCAL_PREF!?  
    looking forward to some expert guidance here to help me squash this one :) 
    thank in advance, 
    Keiran

    Hello,
    Keiran are you talking about "Orgin" attribute or ORIGINATED LOCALLY as this attribute i am not able to find it...that attribute anywhere:
    http://netcerts.net/bgp-path-attributes-and-the-decision-process/
    Path Attributes:
    Attribute
    Class
    ORIGIN
    Well-know mandatory
    AS_PATH
    Well-know mandatory
    NEXT_HOP
    Well-know mandatory
    LOCAL_PREF
    Well-know discretionary
    ATOMIC_AGGREGATE
    Well-know discretionary
    AGGREGATOR
    Optional transitive
    COMMUNITY
    Optional transitive
    MULTI_EXIT_DISC (MED)
    Optional nontransitive
    ORGINATOR_ID
    Optional nontransitive
    ORGINATOR_ID
    Optional nontransitive
    CLUSTER_LIST
    Optional nontransitive
    Also there is similar question on learning forums:
    https://learningnetwork.cisco.com/thread/36845
    From the forum:
    "Locally Originated means that the local router is the one that generated the route with either a network statement, and aggregate statement, redistribution, or conditional route injection.  It's not an attribute that is included in the UPDATE messge, instead it's just used by the local process as part of the path selection, where the router will prefer its own locally originated routes over someone else's origination of the same prefix."
    Hopefully this will help.
    BTW i am reading same book and too bad Mr. Doyle did not include full configs for all routers, as i am trying to simulate his scenarios sometimes it is not working as in his book, now i have issue on next page 197 why Orgin IGP is not taking precedence over Incomplete even if one is learned via EBGP and other over iBGP...driving me nuts.
    Regards,
    Lukasz

  • Combination Algorithm Help

    I have a basic outline of an algorithm that produces combinations of 1-8 but I would like to produce the combination 8C3. What changes need to occur with this problem to get the answer that I'm looking for. Your help will be greatly appreciated. Thanks a lot.
    import java.io.*;
    import java.util.*;
    import java.util.Vector;
    public class Combs
         public static void main(String[] args)
              System.out.println(get("1 2 3 4 5 6 7 8"));
         public static String get(String s)
              StringTokenizer st = new StringTokenizer(s);
              Vector v = new Vector();
              while(st.hasMoreTokens())v.add(st.nextToken());
              String a = "";
              for(int i=v.size()-1; i>=0; i--)
                   for(int j=0; j<v.size(); j++)
                        if(j != i)
                             a += (String)v.get(j);
                   a += "\n";
              return a;
    PS if anything is unclear please ask and I will try to clear up my questions. Thanks again

    I have posted a related code in the following.
    http://forum.java.sun.com/thread.jsp?forum=31&thread=382917&start=0&range=15#1647420

  • Algorithm Help: Adjustable scale marks

    I'm writing an app which displays a scale which is movable and resizable. It might display a range from 0.127 to 0.516, or 10,657 to 100,453.
    1 - I know from the size of the font and window, number number of marks which I want drawn across that range. A value nominally between 10 and 15.
    2 - I want the marks to be on sensible boundaries, 0.1, 0.25, 0.5 etc.
    An example is that for a range 0.089 to 1.272 I'd want ticks 0.1, 0.2 ... 1.1, 1.2
    Can anyone offer me any help with an algorithm to work out the ticks.
    Thanks.
    Dave.

    I have always had to brute force this kind of thing. But I would try the following. Subtract the smaller number from the larger number and divide by the number of ticks. (or the number of ticks + 1, whichever works!) This gives you units per tick. Adjust the lower tick to be the nearest sensible number below your minimum.
    This is tricky and there will be lots of special cases. If your ranges are in any way consistent, it might be best to use a bunch of canned ranges.

  • I need an algorithm, HELP!

    If I input something like this:
    a->b,
    a->c,
    b->d,
    d->a,
    and so on, could be many,
    the the output is this: a->b->d->a, which is a circle from the input.
    I need such a algorithm to help me find out all the circles from the input.

    Cross post of [http://forums.sun.com/thread.jspa?threadID=5447698&tstart=0|http://forums.sun.com/thread.jspa?threadID=5447698&tstart=0].
    Please don't post the same question in multiple forums since people may waste their time answering in one forum when a perfectly good response has been posted in another forum. If you feel the need to get a wider exposure of your problem then create a thread that links to the master thread and request responses be made only in the master thread.
    I shall lock this thread.

  • Genetic Algorithm help please!!!!

    Hi people, i really need help badly with a project im doing as im not very good at programming yet,
    The project is as follows
    Project Allocation
    This project will develop a Genetic Algorithm that will evolve project allocations, with the aim of maximising several criteria: giving every student the highest ranked project possible, spreading the project load between lecturers etc. It should work for a single group of students, and for several groups. This project could be coded in any suitable language.
    Any help in coding this would be really welcomed!
    Thanks

    kennalan wrote:
    your right warneja but what can i do, Start by learning English: that should be "you're", as in "you are".
    What can you do? Do what all students are expected to do - work hard, struggle with difficult material until you achieve some measure of mastery, and accept the result.
    i just need some source code Our source code? Something that you'll steal and pass off as your own? In my universe, that's called "cheating". What do you call it?
    or anything to help!Here's some advice: Don't come back here unless you have problems with code that you've written, with specific questions about the problems.
    Google for something and get started. I recommend "Java genetic algorithms" as a search criterion.
    %

  • HT201210 I have just downloaded ios7 and have lost my iMessages it keeps asking me to sign in which aim doing then says cannot sign it network connection error try again later even though I have full gone and wifi signals please help

    I have just downloaded ios7 and have lost all use of my iMessage I have reset all my settings but still nothing. I have entered my apple ID as requested but keep getting a message saying cannot sign in network connection error try again later even though I have full phone and wifi signals. Please help

    Hello JD_NINJA,
    Thanks for using Apple Support Communities.
    Error 9006 when restoring your iOS device indicates that there is security software on your computer which is preventing connection to the Apple server or your device.  To troubleshoot this issue please follow the directions below.
    Check your security software
    Related errors: 2, 4, 6, 9, 1611, 9006. Sometimes security software can stop your device from communicating with either the Apple update server or with your device.
    Check your security software and settings to make sure that they aren't blocking a connection to the Apple servers.
    Get help with iOS update and restore errors - Apple Support
    When restoring your iPhone, please make sure to follow the directions in the link below to properly restore.
    Restore your device from an iCloud or iTunes backup - Apple Support
    Take care,
    Alex H.

  • Problem with PWM signal, Please Help!

    Hi all,
    I am designing a PWM signal where its output is going to connect 4 optocouplers to drive a H-bridge MOSFETs. However, I am now having a problem of getting an output signal strong enough to drive the optocoupler. 
    I have attached the Multi-Sim file along with this post. Please feel free to help me to solve this problem thank you.
    The version of Multi-Sim I am using is 10.0.144
    Attachments:
    PWM_HCPL0631.ms10 ‏72 KB

    Hi Justin,
    I am slightly confused as to whether this is a problem with Multisim or the design of your circuit.  Are the components in Multisim behaving in an unexpected manner in comparison to their real-world counterparts?
    Regards,
    Thomas Clark
    Applications Engineer
    National Instruments UK & Ireland

  • After updating to 4.3.4 ive lost all signal,  please help

    can any1 help me with this signal problem?

    I've had exactly the same thing happen to me today! Sorry can't offer any help, but you're definitely not alone...
    Hopefully others will either be able to help, or report the same problem.

  • My iphone4 is searching showing me no signal please help

    After I did the update to ios5. I noticed like 3 weeks later my phone now goes into searching for signal at my house. Never did this before. Any help would be great. Thanks

    Does the phone search when you're in a good signal area outside? If so, the problem is the phone and you might be able to cure it by simply resetting your Network Settings.
    If it finds a good signal outside, the problem is with your micro-cell.
    Not sure how they work where youo are but in the UK, Vidafone require you to register your phone online in order to connect.
    Also, you will need to allow it through any firewall you have set-up. The manufacturer will be able to assist with that.

  • No signal strength, help, Im no good at this stuff!

    Hi there.  Thanks in advance to anyone who can help.  I just hooke dup my Linksys wireless router WRT54GS to my desktop and Im trying to make it work on my other desktop on the other  side of the house with a Linksys adapter.  All appears to be working  except I cannot get ANY signal strength on my adapter.  I raised the adapter pretty high and it made no difference.  Any suggestions????

    I assume that the computer wired to the router is getting a working Internet connection.
    It might help to elevate your router.  How far are you trying to get the signal to travel and through how many walls?   Which wireless adapter are you using?  Is there any reasonable way to get the router closer to the wireless computer, or to position the router and wireless adapter in such a way as to eliminate the need to penetrate a wall or two?  Try not to have the router antena too close to the wall.
    Make sure the router's antena has not gotten loose.  If it is loose, tighten it.  It sounds like your wireless computer is on the same floor as the router, if so, make sure antena is verticle.
    Make sure you are using the latest firmware for the router, and the latest driver for your wireless adapter.
    Make sure your router has a unique SSID (do not use "linksys" ).  And make sure that "SSID Broadcast" is set to "enabled".
    Can you see your router's wireless network at all?  Any bars?
    If you are still having trouble, move the wireless computer to be 6-12 feet from the router.  How is the signal now?  Do you have a working connection?
    Message Edited by toomanydonuts on 03-31-200701:30 AM
    Message Edited by toomanydonuts on 03-31-200701:31 AM

  • Logic Execution Algorithm - Help

    Help for me - Logic Execution Algorithm
    Considering the Execution Sequence 1: Consider the following information in the table GBI_PAR_DEFINE_ROTA parameterized.
    The required fields are filled in by users: Required_Res_1 and one of the fields:
    Product_id, customer_id or Sales_Order_No.
    Off the field will only be filled with the value N if you want to disable the rule. If the value of the rule is N, the routine being developed disregard the rule.
    REQUIRED_RES_1 PRODUCT_ID SALES_ORDER_NO CUSTOMER_ID OFF
    P_P_LAM2 P_289874 18669437-20 WHGA
    Step 1: Find Table MP_WO_REP which records have sales order number 18669437-20.
    Step 2: Within these sales orders, search through the table Works_Operation which ones have the field Product_ID = P_289874.
    Step 3: Restrict further data selection Sales_Order searching the table, which of them belong to the client WHGA.
    Step 4: In the records remaining in the table Works_Operation verify which code Alternate_Pref whose field Required_Res_1 equals P_P_LAM2. If more than one return Alternate_Pref (different) for the same product_id Required_Res_1 and generate a table of error called GBI_ERR_ALTERNATE_PREF, containing the following information: Required_Res_1, Works_Order and product_id. If this error occurs, the following steps should not be performed.
    Step 5: In the remaining records, delete those records whose field Alternate_Pref is different from the value returned in Step 4. IMPORTANT NOTE: The records can only be deleted if they exist for the same product_id Alternates_Prefs different. These same deleted records should be inserted in the table Works_Operation_Rota_Excluida.
    Step 6: Deleted records Works_Operation table must also be deleted from the table Works_Op_Char. Fields of connection between these two tables are: Works_Order_No, Version_No, Works_Op_No, Alternate_Pref and Op_Proc_No. Deleted records will be recorded in the table Works_OP_Char_Rota_Excluida.

    I did not offer an opinion.
    You have what is called a technical or program specification. It describes the programming steps that need to be designed and written. This is exactly what programmers do. And your seeming inability to do this, points to the fact that you are not a programmer. That is the issue you need to address - instead of looking for so-called algorithmic logic.
    Simple and basic approach. Take step 1. Write SQL code that satisfies the requirements and outputs of that step. E.g.
    Step 1: Find Table MP_WO_REP which records have sales order number 18669437-20.
    Code: select * from mp_wo_rep where sales_order = '18669437-20'
    Do the same for step 2. And the remaining steps
    You now have the basic code template required to perform these steps. The next actions are:
    Modularising the code (instead of a hardcoded sales order number, support specifying it as a parameter).
    Simplify the code (by combining and integrating processing steps). Real programming is said to be the act of removing program source code statements, and not writing them.

  • 4 counter input & 6 signal input HELP

    Hello Friends,
    I have a little problem, would be great if someone can help me.
    I am using the counter inputs on my Data Acq. Harware to measure the pulse width of my input sigal.
    Since the hardware has only 4 counter inputs I can connect 4 channels, but I want to measure pulse width for 6 channels.
    Is there a way to use the available 4 counters and measure all of the 6 channels?
    Thank you
    Regards,
    Raj
    Solved!
    Go to Solution.

    In my (very basic) example, you could just increase the timeout to ~10+ seconds to ensure you acquire the pulse.  If it's possible that the pulse isn't present within the ~10+ second timeout you would also need to handle the timeout error so it doesn't wrap back around through the shift register and prevent the future reads from executing.
    The downside to this of course is that it could take up to ~60+ seconds to acquire from all 6 channels in the worst case scenario.  The example was really just intended to show how one might use a single counter to acquire from multiple channels in succession.
    The better way to do it with counters would be to run (up to) 4 counter tasks in parallel.  The first 2 tasks to finish with their original acquisition should then measure a second channel.  This could still take ~20 seconds if none of the signals are connected however.
    If you want to trade a lower measurement resolution (and more memory usage) for a lower upper-bound on measurement time you could instead acquire a 10 second window of time using clocked digital inputs and use software to determine the pulse duration by parsing the acquired array.
    Best Regards,
    John Passiak

Maybe you are looking for

  • Unresponsive iTunes under Vista

    Have used iTunes with 3 iPods in the house on XP for years. No issues -- worked flawlessly. Purchased a brand new primary machine for the main floor of our home, running Windows Vista Home Premium. Everything on this thing runs stinking fast, but iTu

  • Registering Essbase 9.3.1 with Shared Services

    What would you expect to see appear in Shared Services when you register an Essbase server? I seem to get random results: sometimes something called Analytic Servers:<hostname> sometimes nothing. Should something appear in HSS just by registering or

  • Having Aperture library on its own drive?

    I'm wondering if it would be advantageous to move the Aperture library to its own drive. I currently have 2 different internal RAID 0 volumes. One of them is comprised of two WD Raptor drives and is my boot drive and contains my applications and Aper

  • The recent IOs 7.1 has been slow and unstable on both my iPad and iPhone, is there a fix?

    The recent IOs 7.1 has been slow and unstable on both my iPad and iPhone, is there a fix? It is very slow, e.g copy and paste from a browser. iPhone 5 & iPad gen 4

  • OS upgrade path

    I have an older Macbook with a 2.4 Ghz intel core 2 duo processor and an Nvidia 9400 m GPU.  I believe this meets the upgrade requirements for the upcoming OSX Mountain Lion.  My issue is that I am still running OS 10.5.8 and mountain lion requires t