elegant solution to address an element of an array [newbie]
From:
BVBA NuKey Music
Subject:
elegant solution to address an element of an array [newbie]
Date:
Fri, 4 Feb 2011 15:53:57 +0100
I am looking forĀ a more elegant solution to the following problem f=26e3:0.1:31e3; An=2*A*abs(sin(pi*f*50e-6))./(pi*400e-6*f); %I then look for the index of the value corresponding with f=27500 %In fact I first wrote f27500_i=find(27500=f), but that doesn't work:
f27500_i=find((27499.9<f) & (f<27500.1)); %determine value of An for 27500Hz in dB fprintf('value of An for 27500Hz in dB is:'),disp(20*log10(An(f27500_i)/sqrt(2)))