在录音机MATLAB 2014版功能中,我有与尺寸有关的问题吗?
我无法在2014版中使用waverecorder
。我试着寻找答案,但我找不到。
请告诉我应该做出哪些更改,以便它们具有相同的大小
Error using +
Matrix dimensions must agree.
Error in FM (line 52)
fm1=cos( W1*t + f_dev1*a1 ); %The FM modulation
function fm1
Did you mean:
>> size(a1)
ans =
1 352800
>> size(t)
ans =
1 1411200
% FM MO.mod&DE.mod code
fs=352800;
x = 88200; % The sample frequency
ts=1/fs; % time steps size
t=0:ts:4-ts; % The time interval, it starts from zero
No= length(t); % length of the time vector
x1 = audiorecorder(x, 16, 1);
disp('Start speaking.')
recordblocking(x1, 4);
disp('End of Recording.');
m1=getaudiodata(x1);
%The transpord to avoid mismatch size of vectors
m1=m1'
cutoff=4000;
[a b]=butter(6,2*cutoff*ts);
y1=filter(a,b,m1) ;
fc1=50000 ; % carrier frequency for fm1&fm3
f_dev1=(2./max(y1))*pi*8000 ;
W1=2*pi*fc1;
a1=(cumsum(y1).*ts); %here size of a1 352800
fm1=cos( W1*t + f_dev1*a1 ); % here is the problem size t of 1411200
wilea1 352800
下面的行将与waverecorder一起使用
fs=352800;
x= 88200; %whatever sampling frequency your system supports
m1=wavrecord(4*x,x) % The length of this vector or speech signal will be 4x which will creat a lot of problems at the code.
m1=resample(m1,fs,x); % Now the length of the vector has been converted to No and everything will work.
我可以将其用于audiorecorder
吗?