Hello there,
I have this problem when implementing my main and my function called "due".
MAIN
clcclearformat longset(groot,'DefaultAxesFontSize',14) set(groot,'DefaultLineLineWidth',1.5)load('Ex1T2_mistery_signal.mat');sample = generateGoldCodeSampled(1,6.5e6,1.023e6,1);corr = zeros(10,6500);for i = 1:10 corr(i,:) = due(i, sample); figure (i) plot (0:6499, corr(1,(0:6499)+1)) grid onend
FUNCTION DUE
function corr = due(PRN, signal_2) pseudo_signal = generateCAcode(PRN); signal_1 = zeros(1,6500); signal_1(1:1023) = pseudo_signal(1:1023); signal_1(1024:2047) = pseudo_signal(1:1023); signal_1(2048:3071) = pseudo_signal(1:1023); signal_1(3072:4095) = pseudo_signal(1:1023); signal_1(4096:5119) = pseudo_signal(1:1023); signal_1(5120:6143) = pseudo_signal(1:1023); signal_1(6144:6500) = pseudo_signal(1:1023); corr = zeros(1,6500); for k = 1:6500 for j = 1:6500 if (j+k-1 <= 6500) corr(1,k) = corr(1,k)+signal_1(j)*signal_2(j+k-1); else corr(1,k) = corr(1,k)+signal_1(j)*signal_2(j+k-6501); end end endend
In what way is the array assignment operation wrong?
Indeed, this is the error that I get!
Unable to perform assignment because the left and right sides have a different number of elements.Error in due (line 7) signal_1(1024:2047) = pseudo_signal(1:1023);Error in maindue (line 13) corr(i,:) = due(i, sample);
PS
pseudosignal is just a sequence of +1 and -1.
Thank you!
Best Answer