×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

mathcad programming for threshold and duration

mathcad programming for threshold and duration

mathcad programming for threshold and duration

(OP)
Need some help, pulling my hair out trying to figure out how to program this in Mathcad. I'm reading data from a data file and plotting that on a graph. From the data I want to determine when the amplitude of the incoming data goes above a threshold for a certain duration. If both the amplitude above the threshold and duration are met, I then want to plot a pulse on another graph. Pulse would just be a "0" or a "1". See attached JPG file. Any help would be appreciated.

RE: mathcad programming for threshold and duration

There may be a clever way to do it but I'd do it in 2 stages, first buid a pulse train where the original signal exceeds the trigger value, then find the length of each pulse and output a new train of single pulses at the start of relevant pulses (although that isn't what your jpg says)

Cheers

Greg Locock


New here? Try reading these, they might help FAQ731-376: Eng-Tips.com Forum Policies http://eng-tips.com/market.cfm?

RE: mathcad programming for threshold and duration

Your OP and picture are not equivalent. Your picture shows a Logic 101 state machine problem.

My only modification to Greg's solution would be to treat the intermediate train as an incrementer, i.e., starting at ground state, when the threshold is exceeded, you start incrementing a counter. If the count exceeds the duration in counts, you generate the output signal. The counter is reset only if the input drops below the threshold.

TTFN
FAQ731-376: Eng-Tips.com Forum Policies

Need help writing a question or understanding a reply? forum1529: Translation Assistance for Engineers

RE: mathcad programming for threshold and duration

(OP)
Greg,

Didn't think of that but your right that would be a round about way to get the results I'm looking for.

Larry

RE: mathcad programming for threshold and duration

(OP)
IRstuff,

I understand how to do this in conventional programming the problem I'm having is putting together the proper programming steps in Mathcad. I'm new to programming to Mathcad and trying to determine the right sequence/program structure to get the results I'm looking for.

RE: mathcad programming for threshold and duration

Here ya go, as you can see there's no tricksiness in it, you get a red pulse at the start of any time the blue signal exceeds the black trigger level for the minimum duration, tho I've put the pulse at the start of the relevant period, which needs a time machine.

I haven't checked it for errors.



Cheers

Greg Locock


New here? Try reading these, they might help FAQ731-376: Eng-Tips.com Forum Policies http://eng-tips.com/market.cfm?

RE: mathcad programming for threshold and duration

(OP)
Greg,

Thanks for the PNG file, however when typing it in exactly as you have it I get an error. Can you post the actual Mathcad file, and what version of Mathchad are you using

Larry

RE: mathcad programming for threshold and duration

(OP)
Want to thank everyone for their feedback, got me going in the right direction. Attached file and data now work the way I want. Once the input signal crosses the threshold then the counter starts. If the counter reaches the value of duration and the input is still above threshold then the dataigoes high. It stays high until the input signal falls below the threshold then it goes low. The counter is also reset at this time. The pulse widths can very but that's not a issue for my application. Note, data file is fairly large (accelerometer data) so only reading a portion of it in the program. Program and data attached in archive file.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


Resources

Low-Volume Rapid Injection Molding With 3D Printed Molds
Learn methods and guidelines for using stereolithography (SLA) 3D printed molds in the injection molding process to lower costs and lead time. Discover how this hybrid manufacturing process enables on-demand mold fabrication to quickly produce small batches of thermoplastic parts. Download Now
Design for Additive Manufacturing (DfAM)
Examine how the principles of DfAM upend many of the long-standing rules around manufacturability - allowing engineers and designers to place a part’s function at the center of their design considerations. Download Now
Taking Control of Engineering Documents
This ebook covers tips for creating and managing workflows, security best practices and protection of intellectual property, Cloud vs. on-premise software solutions, CAD file management, compliance, and more. Download Now

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close