Coder Social home page Coder Social logo

signalgenerator's Introduction

SignalGenerator

This is a C library for generating signals :

  • Sinus
  • Triangle
  • Ramp
  • Square
  • Sawtooth

Signal Parameters

Parameters Range Type Sinus Triangle Ramp Square Sawtooth
Offset F X X X X X
Amplitude F X X X X
Frequency F X X X X
Sampling Frequency Int X X X X X
Phase 0-2ฯ€ F X X X X
Damping Factor F X X X X
Slope F X
Duty Cycle 0-100 F X

Definition :
Damping Factor : It is a coefficient to raw value of each sample like Amplitude
DF in e^(-(DT*time))

How to use

Pass 1 which one you want :

#define INCLUDE_DAMPING 1
#define USE_DOUBLE 0
#define INCLUDE_AMPLITUDE 1
#define INCLUDE_OFFSET 1
#define INCLUDE_PHASE 1
#define INCLUDE_SINLOOKUPTABLE 1

In this Library for calculating Sinus wave there are two ways:

  1. using sin function in math.h
  2. using an array saving 100k samples of one cycle from sinus wave

In order to use second option enable #define INCLUDE_SINLOOKUPTABLE

For each Signals two functions provided : Init and OneSample
Init functions set signal's parameters and should be called at first
OneSample functions give one sample of signal and can be called consecutively

Tests

Two tests provided [both in main.c] :

  1. Generating the signals separately
  2. Generating the the signals together in order to the last sample of previous signal is the offset of next signal

signalgenerator's People

Contributors

alimoal avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.