## Matrix dimension must agree error

Asked by Sana Ahmed

### Sana Ahmed (view profile)

on 26 Nov 2018
Latest activity Answered by Sana Ahmed

### Sana Ahmed (view profile)

on 26 Nov 2018
clear all
%load wgnnoise %% Signal Generation
encsym = 2; % Encoded Symbols per Channel Symbol
Tfactor = 1; % Time/Frequency Scaling Factor
Tsw = 0.025; % Seaweb Pulse Duration (sec)
fc = 4500; % Carrier Frequency (Hz)
% Arbitrary Sequence of Encoded Symbols
x = [0 0 0 1 1 0 1 1 1 1 1 0 0 1 0 0 ...
0 0 0 1 1 0 1 1 1 1 1 0 0 1 0 0];
%x = [x x x x];
bp=.0001; % bit period
disp(' Binary information at Trans mitter :');
disp(x);
%XX representation of transmitting binary information as digital signal XXX
msg=[];
for n=1:1:length(x)
if x(n)==1;
se=ones(1,100);
else x(n)==0;
se=zeros(1,100);
end
msg=[msg se];
end
N = length(msg)/2; % Number of Transmitted Channel
A=5; % Amplitude of carrier signal
br=1/bp; % bit rate
f1=br*8; % carrier frequency for information as 1
f2=br*2; % carrier frequency for information as 0
VectorM = 2^encsym; % Number of Unique Channel Symbols
T = Tfactor*Tsw; % Pulse Duration (sec)
fs = 4*(fc+3/T); % Sampling Frequency (Hz)
Ts = 1/fs; % Sampling Period (sec)
T0 = floor(T/Ts);
t = Ts*(0:(T0-1));
ss=length(t);
kn=[];
for (i=1:1:length(x))
if (x(i)==1)
y=A*cos(2*pi*f1*t);
else
y=A*cos(2*pi*f2*t);
end
kn=[kn y];
end
%Symbolskn = mfskcoder(msg); % Symbol
tvec = Ts*(0:N*length(t)-1); % Time
A = 1; % Amplitude
freqM = kn/(2*T);
freqtx = kron(freqM,ones(1,T0)); % Transmitted Frequency Vector % Transmitted Signal
sig = A*0.5*(exp(1i*2*pi*(fc+freqtx).*tvec)...
+exp(-1i*2*pi*(fc+freqtx).*tvec)); % Loop over Source-Receiver Depths

on 26 Nov 2018