Cosamp has been added to my matlab suit
Why am I getting an error 'Execution of script cosamp as a function is not supported'
36 views (last 30 days)
Show older comments
%% Generate signal, DCT of signal
n = 4096; % points in high resolution signal
t = linspace(0, 1, n);
x = cos(2* 97 * pi * t) + cos(2* 777 * pi * t);
xt = fft(x); % Fourier transformed signal
PSD = xt.*conj(xt)/n; % Power spectral density
% Randomly sample signal
p = 128; % num. random samples, p=n/32
perm = round(rand(p, 1) * n);
y = x(perm); % compressed measurement
% Solve compressed sensing problem
Psi = dct(eye(n, n)); % build Psi
Theta = Psi(perm, :); % Measure rows of Psi
s = cosamp(Theta,y,10,1.e-10,10); % CS via matching pursuit
xrecon = idct(s); % reconstruct full signal
2 Comments
Chris
on 1 Nov 2021
What is cosamp? If it's a FileExchange function, are you capitalizing letters appropriately? If it's something you made, is it a function that accepts inputs and returns an output?
Answers (2)
Elghandouri Mohammed
on 25 Jan 2022
Hi.
Please, have you solved this problem or not? I have the same problem, I don’t know how I can solve it.
Thank you.
3 Comments
Elghandouri Mohammed
on 25 Jan 2022
You should verify the dimension of your matrix theta and the vector y.
May be you have also another script called cosamp.m somewhere in your Matlab path, which Matlab is attempting to run, then you should rename this script or move it.
Chris
on 25 Jan 2022
Edited: Chris
on 25 Jan 2022
Error using _*_
Incorrect dimensions for matrix multiplication. ...
That can be remedied by transposing y, so that its dimensions correlate with Theta's dimensions:
s = cosamp(Theta,y',10,1.e-10,10);
If you are still getting 'Execution of script cosamp as a function is not supported'
Then there is a script called cosamp.m somewhere in your Matlab path, which Matlab is attempting to run.
type which cosamp in the Matlab Command Window to locate it, and rename it or remove it from Matlab's path.
1 Comment
Elghandouri Mohammed
on 25 Jan 2022
The function is working good for me, maybe you should close your Matlab map and open it again.
You should also save the function cosmap.m in the folder where your script program is saved, and remove the old function named cosmap.m
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!