Please Solve the Error...if the run the below code..i got one error ..but logically code correct..the error is Matrix dimensions is not match
Show older comments
function [bit_stream ]=msk_demod( signal_ip,f,Tb)
%msk_demod program for minimum shift keying demodulation
% % Detailed explanation goes here
clc;clear all;close all;
s1=0;s2=0;s3=0;s4=0;
d1=0;d2=0;d3=0;d4=0;
bit_odd=0;bit_even=0;
data1=[0 0];
data2=[0 1];
data3=[1 0];
data4=[1 1];
% data=input('Enter the data size 8 bits {Ex:- format [1 1 1 1 0 0 1 0]} ');
% Tb=input('Enter Bit period time from 0 to 1 {Ex:- 0.1}');
% f=input('Enter frequency in Hz from 0 t0 80 {Ex:-7}');
data=[1 0 0 1 1 1 0 0];
Tb=0.1;
f=7;
signal_ip=msk_mod(data,f,Tb,1);
s1=msk_mod(data1,f,Tb,1);
s2=msk_mod(data2,f,Tb,1);
s3=msk_mod(data3,f,Tb,1);
s4=msk_mod(data4,f,Tb,1);
l=length(signal_ip);
n_samp=l/1000;
ind=1;
samp=signal_ip;
for i=1:n_samp
d1=samp(:,(i-1)*1000+1:(i*l)/4).*s1;
d2=samp(:,(i-1)*1000+1:(i*l)/4).*s2;
d3=samp(:,(i-1)*1000+1:(i*l)/4).*s3;
d4=samp(:,(i-1)*1000+1:(i*l)/4).*s4;
d11=0;d22=0;d33=0;d44=0;
for k=1:1000
if (d1(1,k)>0)
d11=d11+1;
end
if (d2(1,k)>0)
d22=d22+1;
end
if (d3(1,k)>0)
d33=d33+1;
end
if (d4(1,k)>0)
d44=d44+1;
end
end
if (d11 > d22) && (d11 > d33) &&(d11 > d44)
bit_odd=0;
bit_even=0;
end
if (d22 > d11) && (d22 > d33) &&(d22 > d44)
bit_odd=0;
bit_even=1;
end
if (d33 > d22) && (d33 > d11) &&(d33 > d44)
bit_odd=1;
bit_even=0;
end
if (d44 > d22) && (d44 > d33) &&(d44 > d11)
bit_odd=1;
bit_even=1;
end
bit_stream(1,ind)=bit_odd;
bit_stream(1,ind+1)=bit_even;
ind=ind+2;
end
bit_stream
end
8 Comments
Walter Roberson
on 2 May 2018
Apparently we need msk_mod to test this out.
suresh tadikonda
on 2 May 2018
Walter Roberson
on 2 May 2018
I did run. The output was
>> msk_demod
Undefined function or variable 'msk_mod'.
Error in msk_demod (line 18)
signal_ip=msk_mod(data,f,Tb,1);
To get any further I would need to have the code for msk_mod
suresh tadikonda
on 2 May 2018
Edited: Walter Roberson
on 2 May 2018
suresh tadikonda
on 2 May 2018
Walter Roberson
on 2 May 2018
Undefined function or variable 'column_to_row'.
Error in msk_mod (line 37)
signal=column_to_row(Smsk);
Error in msk_demod (line 18)
signal_ip=msk_mod(data,f,Tb,1);
suresh tadikonda
on 3 May 2018
Edited: Torsten
on 3 May 2018
sloppydisk
on 3 May 2018
You could use
reshape(a', 1, numel(a))
instead of your column_to_row function
Answers (0)
Categories
Find more on Communications Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!