powerdart_v2 0.0.3 copy "powerdart_v2: ^0.0.3" to clipboard
powerdart_v2: ^0.0.3 copied to clipboard

Updated version of Lorenzo Calisti's powerdart Compute the Power Spectral Density (PSD) on Dart. This package runs everywhere dart runs.

powerdart #

A Flutter package to compute the Power Spectral Density and analyze its result.

Usage #

To use this package add powerdart as a dependency in your pubspec.yaml file.

Import the library.

import 'package:powerdart_v2/powerdart.dart';

Then create use the methods in the library.

void main() {
  final double fs = 100.0;
  List<double> x;

  // Generate a sinusoidal wave of 100 samples with frequency of 10Hz   
  List<double> t = linspace(0, 1, num: fs.toInt(), endpoint: false);
  x = t.map((e) => cos(2 * pi * 87 * e)).toList();
  
  // Compute his PSD
  final psdRes = psd(x, fs);
  
  // Find where the 70% of the power is
  final area = cumtrapz(psdRes["pxx"], psdRes["f"]);
  final powerDistribution = find(area, (e) => e >= 0.70 * area.last);
}
2
likes
140
points
19
downloads

Publisher

unverified uploader

Weekly Downloads

Updated version of Lorenzo Calisti's powerdart Compute the Power Spectral Density (PSD) on Dart. This package runs everywhere dart runs.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

complex

More

Packages that depend on powerdart_v2