Skip to content

Instantly share code, notes, and snippets.

@Piyush3dB
Piyush3dB / README.md
Last active August 29, 2015 14:04 — forked from mbostock/.block
Dynamic Bubble Chart

Bubble charts encode data in the area of circles. Although less perceptually-accurate than bar charts, they can pack hundreds of values into a small space. This implementation is an improvement on Static bubble chart adding mouse tooltip and cluster attributes. The data shows the Flare class hierarchy.

#!/usr/bin/env python
import numpy as np
# Specify length of signal
N = 512;
# Generate time domain signal
x = np.random.rand(N).astype('complex')
# Evaluate signal power in the time domain
@Piyush3dB
Piyush3dB / SimpleLinSolve
Last active August 29, 2015 14:17
Solve a linear system of equations
m = np.matrix('5 2; -6 4; 1 1')
s = np.matrix('7; 9; 4')
np.linalg.inv(m.H * m) * m.H*s
@Piyush3dB
Piyush3dB / numericGroupDelay.py
Last active August 29, 2015 14:18
Python snippet for a numeric computation of group delay
import numpy as np
N = 20
Nfft = 64
#hn = np.random.rand(N)
hn = np.ones(N)
hnr = hn*np.arange(N)
Tg = np.real(np.fft.fft(hnr, Nfft) / np.fft.fft(hn, Nfft))
@Piyush3dB
Piyush3dB / sine_zoneplate
Created April 14, 2015 14:55
Sinusoidal 2-d zoneplate plot with tanh tapering
#!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
import pdb
# zoneplte
W = 96
H = 96
@Piyush3dB
Piyush3dB / pyLMS.py
Created April 15, 2015 13:11
Simple LMS equaliser in Python
#!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
import pdb
def lms(u, d, M, step, leak=0, initCoeffs=None, N=None, returnCoeffs=False):
if N is None:
N = len(u)-M+1
@Piyush3dB
Piyush3dB / jekyll-latex.markdown
Created April 26, 2015 16:25
Mathjax block aligned equations in Markdown

In line: define $$\mathbf{Y}$$ as the network edges, ...

in block:

$$ P(\mathbf{Y} = \mathbf{y}|\mathbf{X}) = exp[{\theta } ^{T} g(\mathbf{y},\mathbf{X})]/k(\theta ) $$

Block equations:

@Piyush3dB
Piyush3dB / ringLaw.py
Created June 26, 2015 07:51
Ring Law simulation for a large random matrix with gaussain variates
#!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
C = 1
for N in range(20,300,70):
tit = 'N = ' + str(N)
@Piyush3dB
Piyush3dB / BlahutArimoto.m
Created June 30, 2015 14:03
Blahut-Arimoto algorithm implementation in Matlab
function [C r] = BlahutArimoto(p)
disp('BlahutArimoto')
% Capacity of discrete memoryless channel
% Blahut-Arimoto algorithm
% Input
% p: m x n matrix
% p is the transition matrix for a channel with m inputs and n outputs
@Piyush3dB
Piyush3dB / cpp11_test.cpp
Created September 11, 2015 07:54
Short program to test if g++ supports few C++ 11 features.
#include <iostream>
using namespace std;
int main()
{
int arr[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
for(auto i : arr){
cout << arr[i] <<endl;
}
return 0;