So the way I understood it, the random sampling manages to find enough info about the high freq info because some of the times we will have sampled close enough in time domain to catch it. So is it possible to know for sure (or with arbitrarily high probability) if you have enough number of random points to have caught all of the high-freq components w/o knowing the original signal?
It's usually a good assumption which is why it works in practice. If your basis isn't orthogonal than none of this would have worked in the first place. The basis in Fourier space is orthogonal by definition, that's not something you do ad hoc each time you need to sample.
I assume that with the DCT matrix, you can take that matrix and multiply it with a vector to calculate the discrete cosine transform of that vector. In this case, wouldn't "s" already be discrete cosine coefficients since those are the sparse coefficients you are looking for. That is why you do the IDCT at the end to back out the signal. I am just confused why you chose your psi to be the DCT matrix since it seems like you are calculating the discrete cosine transform vector twice. I would think that psi should be the IDCT matrix since x = psi*s and s is the sparse coefficients.
Just ran the code and I can confirm that the optimization occurs significantly better when "dct" is replaced with "idct" in line 35 of the code shown in the video
This is fascinating - could you accomplish the same effect with the signals from two sensors whose sampling rates differ from an integer multiple by a small amount? I'm picturing a pitot tube which splits off into two pressure transducers, one sampling at 128 Hz and the other at, say, 63 Hz. The least common multiple between these is 8064, so I wonder if your effective NyQuist frequency would be thereabouts.
Hi Steve, I am interested to see how matching pursuit would do with complex signals (replacing both cos(2 pi f t) with exp(2j pi f t)). Also, does MATLAB have these matching pursuit functions built-in or are they your custom-written functions?
Hello :) I found your videos a while ago and this is like the 4th time I watch them, and honestly every new time I watched it I realize some new things XD It´s a bit late comment, but I hope I can get an answer. I´m a PhD student, and i´m gonna use Compressed Sensing with wireless sensor netwroks In the code you use the DCT basis, I wanted to know how the code would it be if instead we use Fourier basis or Wavelet basis or changing the perm array, from "random single pixel" to Gaussian or Bernoulli distribution?
I tried this with cvx as I couldn't find the function you used here. It did not work with cvx and resulted in a plausible but different signal. Do you have any idea why this is? I don't. My code at this section was: %% Solve compressed sensing problem Psi = dct(eye(n,n)); % Psi as direct cosinus transform Theta = Psi(perm, :); % resembels multiplication wit 0/1 built C matrix cvx_begin; variable s(n); minimize(norm(s,1)); subject to Theta*s == y'; cvx_end; % Invert cosinus transformation xrecon = idct(s);
I tried this in your code as well and it performs identically when cosamp is replaced with this. Please tell me whether I am doing something terribly wrong or whether these are normal inaccuracies at such a compression level.
Something I don't understand : at 7:18 the amplitude in red of the first component is more of less 600 whereas the true amplitude (in white) is at 1000. So there is a big difference but the reconstructed time serie (in red) is exactly the same as the real one (in white). Can you explain why please ?
The DCT can be written as a matrix multiplication, and dct(eye(n,n)) is a quick and easy way to get this matrix in matlab. It essentially computes the DCT of the nxn identity matrix.
So the way I understood it, the random sampling manages to find enough info about the high freq info because some of the times we will have sampled close enough in time domain to catch it. So is it possible to know for sure (or with arbitrarily high probability) if you have enough number of random points to have caught all of the high-freq components w/o knowing the original signal?
Is it a necessary precondition that you know the basis in which you data is sparse ahead of time? does the basis need to be orthogonal?
It's usually a good assumption which is why it works in practice. If your basis isn't orthogonal than none of this would have worked in the first place. The basis in Fourier space is orthogonal by definition, that's not something you do ad hoc each time you need to sample.
@@mildlyacidic Let's assume you're reasonably sure that your data is NOT sparse in the Fourier domain, how would you proceed?
@@jayuyares Well then you have to go back to the regular Nyquist-Shannon sampling regime.
I assume that with the DCT matrix, you can take that matrix and multiply it with a vector to calculate the discrete cosine transform of that vector. In this case, wouldn't "s" already be discrete cosine coefficients since those are the sparse coefficients you are looking for. That is why you do the IDCT at the end to back out the signal. I am just confused why you chose your psi to be the DCT matrix since it seems like you are calculating the discrete cosine transform vector twice. I would think that psi should be the IDCT matrix since x = psi*s and s is the sparse coefficients.
Just ran the code and I can confirm that the optimization occurs significantly better when "dct" is replaced with "idct" in line 35 of the code shown in the video
That is a really good point! Yes, I believe Psi should be the iDCT matrix. Good catch!
This is fascinating - could you accomplish the same effect with the signals from two sensors whose sampling rates differ from an integer multiple by a small amount? I'm picturing a pitot tube which splits off into two pressure transducers, one sampling at 128 Hz and the other at, say, 63 Hz. The least common multiple between these is 8064, so I wonder if your effective NyQuist frequency would be thereabouts.
Upon doing a little literature search, it looks like this is exactly what I was describing: aip.scitation.org/doi/10.1063/1.5063343 Neat!
Hi Steve, I am interested to see how matching pursuit would do with complex signals (replacing both cos(2 pi f t) with exp(2j pi f t)). Also, does MATLAB have these matching pursuit functions built-in or are they your custom-written functions?
Hello :)
I found your videos a while ago and this is like the 4th time I watch them, and honestly every new time I watched it I realize some new things XD
It´s a bit late comment, but I hope I can get an answer. I´m a PhD student, and i´m gonna use Compressed Sensing with wireless sensor netwroks
In the code you use the DCT basis, I wanted to know how the code would it be if instead we use Fourier basis or Wavelet basis
or changing the perm array, from "random single pixel" to Gaussian or Bernoulli distribution?
i have an wav audio signal at 44100Hz. would it be possible to restore it like this?
How do you get matlab in dark mode?
he's probably inverting the colors with his screen recorder. Even the Mac title bar buttons have a different color 9:10
I tried this with cvx as I couldn't find the function you used here. It did not work with cvx and resulted in a plausible but different signal. Do you have any idea why this is? I don't. My code at this section was:
%% Solve compressed sensing problem
Psi = dct(eye(n,n)); % Psi as direct cosinus transform
Theta = Psi(perm, :); % resembels multiplication wit 0/1 built C matrix
cvx_begin;
variable s(n);
minimize(norm(s,1));
subject to
Theta*s == y';
cvx_end;
% Invert cosinus transformation
xrecon = idct(s);
I tried this in your code as well and it performs identically when cosamp is replaced with this. Please tell me whether I am doing something terribly wrong or whether these are normal inaccuracies at such a compression level.
can you show me how to creat a function Cosamp in this video. Tks u so much
Something I don't understand : at 7:18 the amplitude in red of the first component is more of less 600 whereas the true amplitude (in white) is at 1000. So there is a big difference but the reconstructed time serie (in red) is exactly the same as the real one (in white). Can you explain why please ?
Good question! It shows in the signal, when zoomed out
Why is Psi= dct(eye(n,n))? I'm having a hard time understanding that.
The DCT can be written as a matrix multiplication, and dct(eye(n,n)) is a quick and easy way to get this matrix in matlab. It essentially computes the DCT of the nxn identity matrix.
Very nice 😍💋 💝💖♥️❤️