Hi all! Thank you endlessly for your support from my last question.

I’ve been using sample code from Steve Brunton’s introduction to compressed sensing (https://databookuw.com/databook.pdf , ch.3), and I am trying to change the type of transform that I use on a 2 dimensional signal before reconstructing it. When I do so, CVX will sometimes produce data that is more off than I believe it should be. So, I’m seeking help on either of these points:

- How can I change the signal x to be any random signal instead of a sum of cosines?
- Why does changing the transform to FFT or dwt2 cause CVX errors? How can I avoid these?

**Code **

% build original signal

m = 400; % length

t = linspace(0,1,m);

x = cos(2*pi*97*t) + cos(2*pi*97*t);

plot(x)

% Randomly sample signal

p = 100; % sparsity

perm = round(rand(p, 1) * m);

y = x(perm); % compressed measurement

% Solve compressed sensing problem

Psi = dct(eye(m, m)); % **change here**

Theta = Psi(perm, :);

% L1-Minimization using CVX

cvx_begin;

variable s(m);

minimize( norm(s,1) );

subject to

Theta*s == y’ ;

cvx_end;

xrecon = idct(s);