Login   Register  
PHP Classes

File: index.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Michele Andreoli  >  Probability distribution  >  index.php  >  Download  
File: index.php
Role: Example script
Content type: text/plain
Description: Example of use
Class: Probability distribution
Create noise with Gaussian or Poisson distribution
Author: By
Last change: update file name
Date: 3 months ago
Size: 1,793 bytes


Class file image Download
 * @author Michele Andreoli <michi.andreoli@gmail.com>
 * @name index.php
 * @version 0.3 updated 06-07-2010
 * @license http://opensource.org/licenses/gpl-license-php GNU Public License
 * @package Noise
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
require_once 'Noise.class.php';
// Define a sinuosoidal function
$f = array();
$f[0] = 0;
            for (
$i 1$i 512$i++) {
$f[$i] = sin(M_PI 512 $i);
// Define a exponential function
$g = array();
$index 0;
            for (
$i = -200.0$i 200.0$i += 400.0 512) {
$g[$index] = + (sqrt(pow(200.02.0) - pow($i2.0)));
$noise = new Noise();
$filter = new Filter();
$fft = new FFT(512);
// Add gaussian noise in the sinusoidal function
$f $noise->addGaussian($f00.1);
// Add poissonian noise in the exponential function
$g $noise->addPoisson($g);
// Calculate the FFT of function f with gaussian noise
$f $fft->getAbsFFT($fft->fft($f));
// Remove the high frequency (noise)
$f $filter->filterLP($f1);
// Calculate the inverse FFT of function f, and return the original signal f
$f $fft->ifft($fft->doubleToComplex($f));
$f $fft->complexToDouble($f);
            for (
$i 0$i count($f); $i++)