-
Notifications
You must be signed in to change notification settings - Fork 75
NWaves for MATLAB and sciPy users
Tim Sharii edited this page Mar 9, 2020
·
11 revisions
scipy.signal | NWaves |
z, p, k = tf2zpk(num, den) |
var tf = new TransferFunction(num, den);
var z = tf.Zeros;
var p = tf.Poles;
var k = tf.Gain; |
sos = tf2sos(num, den) |
var tf = new TransferFunction(num, den);
var sos = DesignFilter.TfToSos(tf); |
A, B, C, D = tf2ss(num, den) |
var tf = new TransferFunction(num, den);
var ss = tf.StateSpace;
// then get ss.A, ss.B, ss.C, ss.D |
num, den = zpk2tf(z, p, k) |
// fill real & imag parts
ComplexDiscreteSignal z, p;
var tf = new TransferFunction(z, p, k);
var num = tf.Numerator;
var den = tf.Denominator; |
sos = zpk2sos(z, p, k) |
var tf = new TransferFunction(z, p, k);
var sos = DesignFilter.TfToSos(tf); |
num, den = ss2tf(A, B, C, D) |
var ss = new StateSpace { A=a, B=b, C=c, D=d };
var tf = new TransferFunction(ss);
var num = tf.Numerator;
var den = tf.Denominator; |
num, den = sos2tf(sos) |
TransferFunction[] sos; // fill array
var tf = DesignFilter.SosToTf(sos);
var num = tf.Numerator;
var den = tf.Denominator; |
y = lfilter(num, den, x) |
var filter = new IirFilter(num, den);
// or if den == [1]:
// var filter = new FirFilter(num);
var y = filter.ApplyTo(x); |
y = lfilter(num, den, x, zi=zi) |
var filter = new ZiFilter(num, den);
filter.Init(zi);
var y = filter.ApplyTo(x); |
zi = lfilter_zi(num, den) |
var tf = new TransferFunction(num, den);
var zi = tf.Zi; |
y = filtfilt(num, den, x) |
var filter = new ZiFilter(num, den);
var y = filter.ZeroPhase(x); |
y = sosfilt(sos, x) |
var tf = new TransferFunction(num, den);
var sos = DesignFilter.TfToSos(tf);
var filter = new FilterChain(sos);
var y = filter.ApplyTo(x); |
# cutoff freqs are in range [0..1]:
# fc = 2*f / fs
h1 = firwin(order, 0.2,
window='blackman')
h2 = firwin(order, 0.2,
pass_zero=False)
h3 = firwin(order, [0.2, 0.6])
h4 = firwin(order, [0.2, 0.6],
pass_zero=False) |
// cutoff freqs are in range [0, 0.5]:
// fc = f / fs
var tf1 = DesignFilter.FirWinLp(order, 0.1);
var h1 = tf1.Numerator;
var tf2 = DesignFilter.FirWinHp(order, 0.1, WindowTypes.Hamming);
var h2 = tf2.Numerator;
var tf3 = DesignFilter.FirWinBs(order, 0.1,0.3, WindowTypes.Hamming);
var h3 = tf3.Numerator;
var tf4 = DesignFilter.FirWinBp(order, 0.1,0.3, WindowTypes.Hamming);
var h4 = tf4.Numerator; |
w, h = freqz(num, den, 1024) |
var tf = new TransferFunction(num, den);
var h = tf.FrequencyResponse(1024).Magnitude; |