hello friends, i have a problem with a code section for receiver synchronization. When i run the code, an error is occured. That error is :
??? Error using ==> mtimes
Out of memory. Type HELP MEMORY for your options.
Error in ==> alici at 21
r1 = r*cos(2*pi*f_isaret*t);
load('kayit_alici.mat','r','veri')
f_isaret = 40000;
T_isaret = 1 / f_isaret;
f_AI_sample = 160000;
T_AI_sample = 1/f_AI_sample;
T_bit = 2*power(10,-3);
T_frame = 1;
bosluk = 20;
barker_uz = 13;
veri_uz = T_frame/T_bit - 1 - bosluk - barker_uz;
Hiz = 1 / T_bit;
sample_number_per_bit = T_bit * f_AI_sample;
h = [1 1 1 1 1 -1 -1 1 1 -1 1 -1 1];
h_barker = fliplr(h);
N = sample_number_per_bit;
h_barker2 = reshape(repmat(h_barker,N,1),1,N*length(h_barker));
t = 0:T_AI_sample:T_frame-T_AI_sample;
r1 = r*cos(2*pi*f_isaret*t);
r2 = -j*r*sin(2*pi*f_isaret*t);
rp = r1 + r2;
rp_conv = conv(rp,h_barker2);
rp_c_n = norm(rp_conv);
max_rp_c_n = max(rp_c_n);
% dimension of r is 160000x1
waiting for your helps :)

 Accepted Answer

Walter Roberson
Walter Roberson on 22 Mar 2011
Probably, Change
f_isaret*t
to
f_isaret.*t

7 Comments

osman yurdakul
osman yurdakul on 22 Mar 2011
i tried it a bit ago but the error was the same :(
Walter Roberson
Walter Roberson on 22 Mar 2011
Sorry I didn't look closely enough, f_isaret is not a problem.
However, you load "r" from a file and so we cannot get any hint of what size it is. If it is a vector or array, then you should probably be using r.* instead of r* when calculating r1 and r2.
osman yurdakul
osman yurdakul on 22 Mar 2011
yes, i load 'r' from a mat-file the size of it is 160000x1. 'r' array is samples that have been gotten from a signal that its time 1 sec and the samplig freq is 160 Khz
Matt Tearle
Matt Tearle on 22 Mar 2011
Yup, Walter's right - you need an array multiply there (.*). r is a column vector, but t is a row vector, so cos(...*t) is also a row vector. * is matrix multiply in MATLAB, so it's trying to make r1 a matrix of size 160000-by-length(t). Solution, transpose either t or r and do an array multiply
r1 = r.*cos(...*t');
Same on the next line.
Walter Roberson
Walter Roberson on 22 Mar 2011
Your r is a column vector and your t is a row vector and you are using * which is matrix multiplication. The result would be an array that was 160000 by length(t), which you probably don't want.
But for r.*t to work, r and t would have to have the same number of elements, which it does not appear that your program would promise: for subtle reasons, your t could end up one entry too short. You would be better of defining t as
t = linspace(0,T_frame,f_AI_sample+1);
t(end) = [];
This would have the correct length for element-by-element multiplication by a vector of length f_AI_sample .
Walter Roberson
Walter Roberson on 22 Mar 2011
If you transposed t but used * then you would get an error about inner dimensions must agree. If you transposed r but used * then you would get a single value as output, not a vector the same length as t.
osman yurdakul
osman yurdakul on 22 Mar 2011
thank you friends it worked :) really thank you... i get it now :)

Sign in to comment.

More Answers (0)

Categories

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!