I'm trying to implement the MUSIC algorithm and I chose Julia to write my code.
DOA=ones(1,rand(1:10))
for i in 1:length(DOA)
DOA[1,i]=rand(0:1000)*pi/180;
end
sensors=11;
freq=ones(1,length(DOA[1,:]))
for i in 1:length(DOA)
freq[1,i]=rand()*pi*100;
end
signals=length(DOA);
lambda=100;
dist=lambda/2;
A=zeros(signals,sensors);
snr1=rand(20:40);
N=200;
x=zeros(length(freq),N);
for j = 1:length(freq), for k = 1:signals
x[j,k]=2*exp(im*freq[j]*k);
end
for l = 1:signals, for m = 1:sensors
A[l,m]=exp(-im*2*pi*dist*sin(DOA[1,l])*m/lambda));
end
So for j = 1:length(freq), for k = 1:signals shows no error but the one after, for l = 1:signals, for m = 1:sensors, keeps showing the 'invalid iteration specification' error.
My novice tries include, commenting the for loop, deleting it completely and giving spaces in between just to see what was going on. Surprisingly, even after I saved the file numerous times and started a new bash session it showed me the same error for a commented for loop and blank spaces. Any ideas about tackling this problem? Or better yet, what can cause such errors? I've attached a screenshot too for the specifics, line 38 being the for loop with the error.
