New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

ndarray-freqz

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ndarray-freqz

Frequency Response of a z-transformed Transfer function

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
3
200%
Maintainers
1
Weekly downloads
 
Created
Source

ndarray-freqz

Compute the frequency response of a digital filter based on it's transfer function.

Introduction

This scijs compatible module calculates the frequency response of a given transfer function, described by the coefficient of the numerator and denominator polynomials.

|           jw              -jw            -jmw
|    jw  B(e)    b[0] + b[1]e + .... + b[m]e
| H(e) = ---- = ------------------------------------
|          jw               -jw            -jnw
|        A(e)    a[0] + a[1]e + .... + a[n]e

Inspired by the scipy.signal.freqz function.

Sample usage:

var freqz = require('ndarray-freqz')

var b = [0.5, 0.5];
var a = [1];

var fr = freqz(b, a);

fr.H_r // real part of the frequency response.
fr.H_i // imaginary part of the frequency response.

var magnitude = zeros([512])

cops.mag(magnitude, fr.H_r, fr.H_i);

Install

$ npm install ndarray-freqz

API

freqz( b, a, [omega] )

Compute the frequency response of a digital filter based on it's transfer function.

  • b Array/ndarray of the numerator polynomial coefficients of the filter transfer function.
  • a Array/ndarray of the denominator polynomial coefficients of the filter transfer function.
  • omega Optional Array/ndarray of frequency (in radians/sample) values to calculate the frequency response for. If the value is a Number, then frequency response will be calculated for that many frequencies equally spaced around the unit circle. If undefined then frequency response will be calculated at 512 frequencies equally spaced around the unit circle.

Returns a object with following components

  • H_r ndarray of the real part of the generated frequency response.
  • H_i ndarray of the imaginary part of the generated frequency response.
  • omega ndarray of the frequencies of the generated frequency response.

Credits

(c) 2016 Chinmay Pendharkar. MIT License

Keywords

filter

FAQs

Package last updated on 13 Jun 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts