error: matrix dimension should agree plz help me

1 view (last 30 days)
Audio transmission through BPSK modulation.any .wav or other audio format can be place after wavreadcommand. getting errors like matrix dimensions must agree etc.
A=5;
t=0:1:165877;
f1=input('Carrier Sine wave frequency =');
y=wavread('C:\Users\Personal\Desktop\ked\qw.wav'); %it is one .wav file I’m attaching that too.
lsb=bitand(y*32768+32768,1);
plot(lsb);
figure(2);
plot(y);
x=A.*sin(2*pi*f1*t);%Carrier Sine
subplot(3,1,1);
plot(t,x);
title('Carrier');
grid on;
v=x.*lsb;%Sine wave multiplied with square wave
subplot(3,1,3);
plot(t,v);
axis([0 1 -6 6]);
title('BPSK');
grid on;

Answers (1)

Geoff Hayes
Geoff Hayes on 26 Oct 2014
Which line of code is generating the error message? Try stepping through the code and verify that the matrix multiplications make sense with respect to the dimensions of each matrix. In particular, check the line
v=x.*lsb;
which assumes that x is a 1x165878 array which means that lsb must be of the same size. Since lsb is created based on the audio file that you are reading in (C:\Users\Personal\Desktop\ked\qw.wav), then you must make sure that t (which is used to create x) is of the same length as y.

Categories

Find more on Acoustics, Noise and Vibration in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!