필터 지우기
필터 지우기

an error in modulation

조회 수: 1 (최근 30일)
ahmad ramadan
ahmad ramadan 2019년 2월 25일
i want to translate(modulate) the recorded signal by 5kHz , but i get an error shown below last line
%we define the time interval
fs=100*1000;
ts=1/fs;
t=0:ts:5-ts;
No=length(t) %how many points in t
nbit = 16 ; %Bits per sample
m = audiorecorder(fs,nbit,2)
disp('Start speaking.')
recordblocking(m, 5); %limit the recording by 5 sec
disp('End of Recording.')
play(m); % Play the speech
r = getaudiodata(m);%Store recorded audio signal in numeric array
figure(1) ;
plot (t,r)
xlabel ('time')
ylabel('amplitude') ;
title('speech over time')
%finding the FT for the signals
M=abs(fftshift(fft(r)/No));
%creating the vector for the frequency axis
f=[-No/2:No/2-1]/(No*ts);
figure(2);
plot (f,M) ; % plot the magnitude spectrum
xlabel ('frequency')
ylabel('amplitude') ;
title('Magnitude Spectrum of speech')
fc = 5000; %carrier frequency
c=cos(2*pi*fc*t); % carrier to translate frequency by 5kHz
y = r;
g=r.*c;
%finding the FT for the signals
G=abs(fftshift(fft(g)/No));
figure 2;
plot (f,G) ; % plot the magnitude spectrum of translated signal
xlabel ('frequency')
ylabel('amplitude') ;
title('translated spectrum by 5Khz')
the error is
Error using .*
Matrix dimensions must agree.
Error in ex4 (line 30)
g=r.*c;

답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with Signal Processing Toolbox에 대해 자세히 알아보기

태그

제품


릴리스

R2013b

Community Treasure Hunt

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

Start Hunting!

Translated by