Menu

Hi Everyone Could Help Fix Error Script Script X Fs Audioread Falihwav X X 1000 5000 T 0 1 Q43780756

Hi everyone Could you help to fix this error from this script:

Script

[x,Fs] = audioread(‘Falih.wav’);
x=x(1000:5000);
t = 0:1:length(x)-1;

%fourier transform
k=0;
for f=linspace(0,Fs/2,1000)
k=k+1;
X(k)=trapz(t,x’.*exp(-1j*2*pi*f*t));
end
f = linspace(0,Fs/2,1000);
figure;
subplot(2,1,1);
plot(f,abs(x));
grid;
xlabel(‘f in Hz’);
ylabel(‘|X(f)|’);
title(‘magnitude response’);
subplot(2,1,2);
plot(f,angle(x));grid;
xlabel(‘f in HZ’);
title(‘Phase Response’)
ylabel(‘<X(f)>’);

and this is the Error :

In an assignment A(:) = B, the number of elements in A and Bmust be the same.

Error in Bonus1 (line 9)
X(k)=trapz(t,x’.*exp(-1j*2*pi*f*t));

Expert Answer


Answer to Hi everyone Could you help to fix this error from this script : Script [x,Fs] = audioread(‘Falih.wav’); x=x(1000:5000); …

OR