Code Snippets in Matlab

- Define a signal x = A * cos(wt)+cos(2wt) for t from 0 to 1000 in steps of 0.01, w = 2*pi * [1, 3,5,7]. Plot this signal. Take Fourier Transform, show the peak. Bring any peak to the center using cshift. Take 20*log10(abs()) to show dB. Define a new signal y = x + A * sin(3.1*wt) for the same w and repeat the steps done for x. Plot both dB plots on the same graph.

[ Download ]

- Some basic and advanced Signal Processing

[ Download ]

- Generate uniformly distributed random variable x [-1, 1]. Quantize the  data using 2, 4, 8 bits. In each case plot SQNR vs number of bits. Repeat with standard normal distribution. Quantize data with mu law quantizer.

[ Download ]

- Generate 1000 column vectors of size 1000x1 such that its elements are random. Combine those 1000 column vector to form a single matrix of 1000*1000 matrix. Now the resultant matrix is A. a)Find Eigen values of A, eigenvectors. b)Find Determinant of A.

[ Download ]

- Generate a random 10*10 matrix [Aij]= 1/(i+j+1) Hilbert Matrix. a) Circularly shift the Hilbert matrix by ‘n’ steps. b) Implement the circular shift without using predefined functions. Find the condition number, LU Decomposition and SVD Decomposition of the matrix. Also find the determinant of the matrix using LU decomposition, Eigen value system and SVD decomposition. Perform the above problem for matrixes of order 2*2 and 5*5.

[ Download ]

- Take a waveform (sine or square or triangular…). a) Plot the original waveform. b) Plot only the lower part of the assumed waveform. c) Plot only the upper part of the assumed waveform.

[ Download ]

- Mutual information is a statistical similarity measure is used in image retrieval. Given two images A and B , MI is computed as MI= H(A)+H(B)-H(A,B), where H(A) and H(B) are marginal entropies and H(A,B) is the joint entropy. Given two images compute the marginal and joint entropies. Compute the mutual information. Plot the 2-D joint histogram. Where entropy is given as H(A)=summation( p log p). Avoid log(0) by using H(A)=summation plot(p+1).

[ Download ]