Program:
clc;
clear all;
b = input('Enter the Bit stream = ');
n = length(b);
t = 0:0.01:n;
x = 1:1:(n+2)*100;
for i = 1:n
if (b(i) == 0)
u(i) = -1;
else
u(i) = 1;
end
for j = i:0.1:i+1
bw(x(i*100:(i+1)*100)) = u(i);
if (mod(i,2) == 0)
bw_o(x(i*100:(i+1)*100)) = u(i);
bw_o(x((i+1)*100:(i+2)*100)) = u(i);
else
bw_e(x(i*100:(i+1)*100)) = u(i);
bw_e(x((i+1)*100:(i+2)*100)) = u(i);
end
if (mod(n,2)~= 0)
bw_o(x(n*100:(n+1)*100)) = -1;
bw_o(x((n+1)*100:(n+2)*100)) = -1;
end
end
end
bw = bw(100:end);
bw_e = bw_e(100:(n+1)*100);
bw_o = bw_o(200:(n+2)*100);
wo = 2*pi*t*(5/4);
Wt = 2*pi*t/(4*1);
st = bw_o.*sin(wo+(bw_e.*bw_o).*Wt);
subplot(4,1,1);
plot(t,bw);
xlabel('Time ---->');
ylabel('Amplitude ---->');
title('Input Bit Stream');
grid on;
axis([0 n -2 +2]);
subplot(4,1,2);
plot(t,bw_o);
xlabel('Time ---->');
ylabel('Amplitude ---->');
title('Odd Sequence');
grid on;
axis([0 n -2 +2]);
subplot(4,1,3);
plot(t,bw_e);
xlabel('Time ---->');
ylabel('Amplitude ---->');
title('Even Sequence');
grid on;
axis([0 n -2 +2]);
subplot(4,1,4);
plot(t,st);
xlabel('Time ---->');
ylabel('Amplitude ---->');
title('MSK Modulated Wave');
grid on;
axis([0 n -2 +2]);
clear all;
b = input('Enter the Bit stream = ');
n = length(b);
t = 0:0.01:n;
x = 1:1:(n+2)*100;
for i = 1:n
if (b(i) == 0)
u(i) = -1;
else
u(i) = 1;
end
for j = i:0.1:i+1
bw(x(i*100:(i+1)*100)) = u(i);
if (mod(i,2) == 0)
bw_o(x(i*100:(i+1)*100)) = u(i);
bw_o(x((i+1)*100:(i+2)*100)) = u(i);
else
bw_e(x(i*100:(i+1)*100)) = u(i);
bw_e(x((i+1)*100:(i+2)*100)) = u(i);
end
if (mod(n,2)~= 0)
bw_o(x(n*100:(n+1)*100)) = -1;
bw_o(x((n+1)*100:(n+2)*100)) = -1;
end
end
end
bw = bw(100:end);
bw_e = bw_e(100:(n+1)*100);
bw_o = bw_o(200:(n+2)*100);
wo = 2*pi*t*(5/4);
Wt = 2*pi*t/(4*1);
st = bw_o.*sin(wo+(bw_e.*bw_o).*Wt);
subplot(4,1,1);
plot(t,bw);
xlabel('Time ---->');
ylabel('Amplitude ---->');
title('Input Bit Stream');
grid on;
axis([0 n -2 +2]);
subplot(4,1,2);
plot(t,bw_o);
xlabel('Time ---->');
ylabel('Amplitude ---->');
title('Odd Sequence');
grid on;
axis([0 n -2 +2]);
subplot(4,1,3);
plot(t,bw_e);
xlabel('Time ---->');
ylabel('Amplitude ---->');
title('Even Sequence');
grid on;
axis([0 n -2 +2]);
subplot(4,1,4);
plot(t,st);
xlabel('Time ---->');
ylabel('Amplitude ---->');
title('MSK Modulated Wave');
grid on;
axis([0 n -2 +2]);
Output:
Enter the Bit stream = [1 0 1 1 1 0 1]
Waveform:
dude it is wrong code try to correct it. i didn't even get input bit stream please correct it quickly.
ReplyDeletePlease let me know the input you entered...
ReplyDeleteits wrong code. i entered bit same bit stream as you shown below code. But output is quite different!!!!!
ReplyDeleteSend me your output graphs along with the bit streams you entered so that i can check and correct the error if there is any...
ReplyDeleteit is wrong..correct it yaar...
ReplyDeletehow is the phase changing in MSK
ReplyDeleteHey nebu in the second for loop there is j=i:0.1:i+1; but j has never been used after that can you check that and suggest the modifications to be done.
ReplyDeletepls send the demodulation code.
ReplyDeletesend the demodulation code of this modulation on sahoo.pritamkeshari@gmail.com
ReplyDeleteThanks a lot.
Please send me the right code
ReplyDelete