Pages

Tuesday, 18 September 2012

MSK (Matlab 2012a)

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]);

Output:
Enter the Bit stream = [1 0 1 1 1 0 1]

Waveform:
    

10 comments:

  1. dude it is wrong code try to correct it. i didn't even get input bit stream please correct it quickly.

    ReplyDelete
  2. Please let me know the input you entered...

    ReplyDelete
  3. its wrong code. i entered bit same bit stream as you shown below code. But output is quite different!!!!!

    ReplyDelete
  4. Send me your output graphs along with the bit streams you entered so that i can check and correct the error if there is any...

    ReplyDelete
  5. it is wrong..correct it yaar...

    ReplyDelete
  6. how is the phase changing in MSK

    ReplyDelete
  7. Akhil vasireddy17 Apr 2016, 17:35:00

    Hey 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.

    ReplyDelete
  8. pls send the demodulation code.

    ReplyDelete
  9. send the demodulation code of this modulation on sahoo.pritamkeshari@gmail.com
    Thanks a lot.

    ReplyDelete
  10. Please send me the right code

    ReplyDelete