Matlab SVD Noise reduction - matlab

I have some FID data that i can convert to FFT and can have some NMR signal. But my signal's are not that high compare to my noise in the data. I know that using SVD can solve the problem in Matlab but i need more insight how to do it. My every single NMR is a 1024x1 matrix.
I tried the SVD and didnt really found any good solution.

Related

Compressed sensing using matlab

I am trying to implement compressed-sensing technique using matlab to reconstruct an image from fewer measurements.
What I've done so far is dividing the image into 8-by-8 blocks, then multiply each block by sensing matrix PHI which is Gaussian random matrix, after that decode the compressed blocks using CVX or L1 Magic.
The problem is that I don't get good results, so can someone help me please ?
example code
x=imread('greyscale_image.tiff');
x=im2double(x);
x_1blk=x(1:8,1:8);
xdct=dct2(x_1blk);
xq=xdct/quanMTX;
xq=reshape(xq,[],1);
y=phi*xq;
x0=phi.'*y;
tic
s1=l1eq_pd(x0, phi, [], y,1e-3);
toc
s1=reshape(s1,8,8);
s1=s1*quantMTX;
s1=idct2(s1);
I get around 25.000 for psnr, while I am expecting to get around 29.000

Matlab: Determinant of VarianceCovariance matrix

When solving the log likelihood expression for autoregressive models, I cam across the variance covariance matrix Tau given under slide 9 Parameter estimation of time series tutorial. Now, in order to use
fminsearch
to maximize the likelihood function expression, I need to express the likelihood function where the variance covariance matrix arises. Can somebody please show with an example how I can implement (determinant of Gamma)^-1/2 ? Any other example apart from autoregressive model will also do.
How about sqrt(det(Gamma)) for the sqrt-determinant and inv(Gamma) for inverse?
But if you do not want to implement it yourself you can look at yulewalkerarestimator
UPD: For estimation of autocovariance matrix use xcov
also, this topic is a bit more explained here

Smooth out Image Vector in Matlab

I have an image that I converted to a vector and plotted:
img = imread(image.png');
grayImage = rgb2gray(img);
grayImage(2:2:end,:)=fliplr(grayImage(2:2:end,:));
B = rot90(grayImage);
C = flipud(B);
[x,y]=size(C);
vector = reshape(C ,1,x*y);
plot(vector);
The problem is that although I can visually see a wave pattern, there is a lot of noise that occurs. By noise I mean the signals rapidly go up and down eventually forming a sinusoidal wave but I want to be able to just connect the crest of each spike to one another in order to create a continuous wave pattern. If anyone understands what I am trying to do, help would be appreciated.
Thank you in advance.
Not 100% sure about what you're asking, but the medfilt1 median filter function might be what you're looking for, it's a 1D smoothing filter. Example usage would be:
vector_filt = medfilt1(vector);
Check out the documentation and example at http://www.mathworks.com/help/signal/ref/medfilt1.html.
I think performing a gaussian convolution on the vector should solve your problem. Here is a link to a stack overflow question that has a very nice answer on how to do a gaussian convolution in matlab: Gaussian Filter on a vector in Matlab

symmetric FFT in matlab

I'm going to implement OFDM system in matlab. I need to take IFFT symmetric from data and then again FFT from results. the IFFT goes right, but the FFT doesn't, fisrt half of result numbers are like data bef0r IFFT, but second half is wrong. I just don't know should I use FFT function when I know the IFFT took 'symmetric'.
here is the functions I used:
x_ifft=ifft(x1, 'symmetric')
x_fft=fft(x_ifft);
Thank you
You should not use "symmetric", but should use fftshift either after ifft or after fft.

scaling when sampling from multivariate gaussian

I have a data matrix A (with dependencies between columns) of which I estimate the covariance matrix S. I now want to use this covariance matrix to simulate a new matrix A_sim. Since I assume that the underlying data generator of A was gaussian, I can simply sample from a gaussian specified by S. I do that in matlab as follows:
A_sim = randn(size(A))*chol(S);
However, the values in A_sim are way larger than in A. if I scale down S by a factor of 100, A_sim looks much better. I am now looking for a way to determine this scaling factor in a principled way. can anyone give advise or suggest literature that might be helpful?
Matlab has the function mvnrnd which generates multivariate random variables for you.