Another typo fix in Mandatory 2

The second hint of Part A task 2 has now been clarified in order to avoid getting the wrong order of operator parsing in Matlab.

It turns out there was a mistake in generate_data.m where the steering vectors were defined via

a1 = exp(j*phi1).^[0:M-1]';
a2 = exp(j*phi2).^[0:M-1]';

Because Matlab in that case parsed the ' operator (complex conjugate transpose) as the last operation, in fact the steering vectors became complex conjucated compared to the operation

a1 = exp(j*phi1).^([0:M-1]');
a2 = exp(j*phi2).^([0:M-1]');

But this was alright as long as you would use the expression

a = exp(j*phi).ˆ[0:(M-1)]’;

in the beamforming code - since this "fixes back" the complex conjugate when sweeping over angles.

A correct operator parsing is achieved if the sweeping steering vector is instead:

a = exp(j*phi).ˆ([0:(M-1)]’);

To make the conventions fit with the Krim & Viberg paper, we can hence edit lines 46-47 in the generate_data.m code to use

a1 = exp(j*phi1).^([0:M-1]');
a2 = exp(j*phi2).^([0:M-1]');

A new version of generate_data.m with this approach is now uploaded to the course material.

[Another option is to keep the "old" generate_data.m, and instead to use the sweeping steering vector as a = exp(j*phi).ˆ[0:(M-1)]’;]

Interested in more details on Matlab operator precedence? Read more here: https://se.mathworks.com/help/matlab/matlab_prog/operator-precedence.html

Published Mar. 30, 2022 2:09 PM - Last modified Mar. 30, 2022 4:24 PM