I am working on a project that uses the tangent law to localize a phantom source in the typical stereo setup (two loudspeakers at 60º angle). Since the tangent law shows a relation between the angle of the phantom image and the gain of the loudspeakers, my aim is to plot the amplitude response in dB of one loudspeaker at the different angles of the phantom source, here is the code that works fine with the source positioning:
%-----stereo panning------%
%variables:
Fs = 44100;
theta = 25; %virtual source
phi = 30; %loudspeaker
g(1) = 1; %L gain
g(2) = -(tan(theta)-tan(phi)) / (tan(theta)+tan(phi));
%sum of gains has to be normalized
g = g/sqrt(sum(g.^2));
signal=mod([1:20000]',200)/200; %signal
loudsp_sig=[signal*g(1) signal*g(2)]; %panning
soundsc(loudsp_sig,Fs); %play audio
I tried creating a theta vector and tried plotting (theta, 20*log(g(2)), also using table but either it gives me an error or plots only one point, I'm clearly missing something here.