Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Whats wrong with this PSK Matlab Code?

Status
Not open for further replies.

Girly_girl

Full Member level 2
Full Member level 2
Joined
Oct 14, 2009
Messages
143
Helped
9
Reputation
18
Reaction score
8
Trophy points
1,298
Location
UK
Activity points
2,125
Hey guys

Hope u r all well.

I have written a matlab code for PSK.. and it produces a graph... but i know that the graph is not what im looking for .. it doesnt produces a correct phase shift..

The code is :

% % Generating a input square wave
x1 = 0:(pi/100):(20*pi);
y1 = square(x1);
A = plot(x1,y1);
figure(1),A,title( 'Square wave');xlabel('x'); ylabel('y');ylim([-2,2]);grid;

% Generating the PSK signal

y1(y1>0)=1;
y1(y1<0)=0;

N = y1.*pi;
f=1;
t = 0:(pi/100):(20*pi);
PSK = sin(2*pi*f*(t+ N));
figure(2),plot(t,PSK),title('PSK Signal');xlabel('x'); ylabel('y');ylim([-2,2]); xlim([0,35]);grid;


The PSK signal it produces is :
b9bqq9.jpg
 

Found it. I will check it and will give you an answer. Some remarks:
a)I can not see the produced PSK signal that you put (my browser has a prolem probabbly.. )
b)What PSK do you want to simulate? BPSK,QPSK... what? From the PSK equation that you are using it seems that you are trying to get BPSK. Check it.
c)It seems to me, that in your PSK signal you only get the inphase signal which is only a part of the signal. In order to get the full BPSK you need both inphase
and quadrature signal.

A general note : Read Proakis books. They are very good, introductory and with a lot of things to think on..
 
Found it. I will check it and will give you an answer. Some remarks:
a)I can not see the produced PSK signal that you put (my browser has a prolem probabbly.. )
b)What PSK do you want to simulate? BPSK,QPSK... what? From the PSK equation that you are using it seems that you are trying to get BPSK. Check it.
c)It seems to me, that in your PSK signal you only get the inphase signal which is only a part of the signal. In order to get the full BPSK you need both inphase
and quadrature signal.


A general note : Read Proakis books. They are very good, introductory and with a lot of things to think on..

Many thaks
The psk is the bpsk.
Regarding the book, i have just found a book and im trying to get an electronic version of it..
Digital Communications by John G. Proakis is the name of the book.

Thanks for your help..

I didnt understand what u mean by the highlited text.
 
b)Ok
c)The browser highlighted it. Check the book and you will understand. For a quick view check wikipedia in psk modulation
 
Hey Tom,

Hope you are good.

Do you have any idea on how to improve this code?

I'd really appriciate your kindness in responding to this problem...

Thanks
 

there are built in functions u can use
just give it input and kind of modulation and take the output :)
 
THanks mr byte
But wat are these built in functions?
 

hmmm what i can remember
pskmod
try to search about this function
 

Hello, thanks for your reply
The Matlab im using doesnt recognise such a thing as pskmod :-s
 

Hello. I am giving the m file for bpsk modulation
The equations are from chapter 4 of proakis book. they are equations 4-3-11 to 4-3-16.

-------------------------------------------------

%% Generating input pulses
clear all;clc;close all;
baseband1=ones(1,2000); baseband0=-ones(1,2000);
bandpass=[ones(1,1000) -ones(1,1000)];

%% General Conditions
fc=1; t = 0:(pi/100):(20*pi-pi/100);
M=2;

%% Bandpass PSK
%Bandpass PSK = N.*cos(2*pi*fc*t+(2*pi/M)*(m-1));
m=1; PSK_Bandpass_1 = bandpass.*cos(2*pi*fc*t+(2*pi/M)*(m-1));
m=2; PSK_Bandpass_2 = bandpass.*cos(2*pi*fc*t+(2*pi/M)*(m-1));
figure(2),plot(t,PSK_Bandpass_1),title('PS Bandpass 1');xlabel('time'); ylabel('data');grid on;
figure(3),plot(t,PSK_Bandpass_2),title('PS Bandpass 2');xlabel('time'); ylabel('data');grid on;

%% Baseband PSK
%Baseband PSK Sm1 = pulse.*cos((2*pi/M)*(m-1)) for pulse = baseband1
m=1; PSK_Baseband_1 = baseband1.*cos((2*pi/M)*(m-1));
figure(4),plot(t,PSK_Baseband_1),title('PS Baseband 1');xlabel('time'); ylabel('data');grid on;

%Baseband PSK Sm2 = pulse.*sin((2*pi/M)*(m-1)) for pulse = baseband0
m=2; PSK_Baseband_2 = baseband0.*sin((2*pi/M)*(m-1));
figure(5),plot(t,PSK_Baseband_1),title('PS Baseband 1');xlabel('time'); ylabel('data');grid on;

-------------------------------------------

Sorry for the delay, but better late than late.
Hope to help.
 
Thank you so much Tom, U r a star
Many thanks for your time and help

Appriciated
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top