why do I get the error : Index exceeds matrix dimensions?
显示 更早的评论
hello all! I am trying to do channel estimation using compressive sensing using basis pursuit denoising from spgl in matlab. following is my code segment. but I am constantly getting the error:
Index exceeds matrix dimensions.
Error in partialFourier (line 8)
y = z(idx);
Error in @(x,mode)partialFourier(p,ofdm.N,x,1)
Error in aunt (line 106)
Rb=opA(y(i),1);
I have tried to match the dimensions of both but its not working. can anyone help me please.
%%%%%%%%%%%%%%%%%%code for spg_bpdn%%%%%%%%%%%%%%
ofdm.N=128;
ofdm.PP=13;
ofdm.B=1;
%%Saprse Channel estimation
H_Sparse = zeros(ofdm.N,ofdm.B);
m=50;k=14;
for b = 1 : ofdm.B
p = randperm(ofdm.N); p = p(1:k);
opts = spgSetParms('verbosity',0);
opA= @(x,mode) partialFourier(p,ofdm.N,x,1);
y=zeros(ofdm.N,1);
y(p) = ofdm.N/ofdm.NP *fft(ifft(dataRxFFT(ofdm.PP,1)));
y=y(p);
Rb=opA(y(p),1);
x=spg_bpdn(@(x,mode)opA(x,mode),Rb,0.05,opts);
H_Sparse(:,1)=ofdm.N/ofdm.NP * fft(ifft(vec2mat(x,ofdm.N)));
end
3 个评论
dpb
2014-8-27
The error was an assignment in the function partialFourier (line 8)
y = z(idx);
but none of the code you posted has anything to do directly with it...
One presumes by the variable name that idx is an index value (or possibly an array from find or the like) and that the returned value is outside the ranges you're expecting...
Image Analyst
2014-8-27
fft(ifft(X)) = X, so what's going on there?
采纳的回答
更多回答(1 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Image Transforms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!