Code for generating PSK signal using MATLAB!!!
x=input('input binary message sequence');
N=length(x);
x(x==0)=-1;
t=0.001:0.001:N;
for i=1:1:N;
m((i-1)*1000+1:i*1000)=x(i);
end
c1=2*sin(2*pi*5*t);
y=m.*c1;
subplot(3,1,1);
plot(t,m);
xlabel('Time');
ylabel('Amplitude');
Title('Bit sequence');
subplot(3,1,2);
plot(t,c1);
xlabel('Time');
ylabel('Amplitude');
Title('Carrier');
subplot(3,1,3);
plot(t,y);
xlabel('Time');
ylabel('Amplitude');
Title('PSK signal');
N=length(x);
x(x==0)=-1;
t=0.001:0.001:N;
for i=1:1:N;
m((i-1)*1000+1:i*1000)=x(i);
end
c1=2*sin(2*pi*5*t);
y=m.*c1;
subplot(3,1,1);
plot(t,m);
xlabel('Time');
ylabel('Amplitude');
Title('Bit sequence');
subplot(3,1,2);
plot(t,c1);
xlabel('Time');
ylabel('Amplitude');
Title('Carrier');
subplot(3,1,3);
plot(t,y);
xlabel('Time');
ylabel('Amplitude');
Title('PSK signal');
Output:Input sequence [1 1 0 1 0 1 1 0]
No comments:
Post a Comment