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.

please help -problem in m-file for PN code generation

Status
Not open for further replies.

thegoner_online

Newbie level 3
Joined
Mar 30, 2013
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,306
i use this code for generating a PN code and the matlab show me this error " ??? Undefined function or method 'PN' for input arguments of type 'char'.

please help me what the error in code



%PN_sequence_generation.m
clear
clc
G=63; % Code length
%Generation of first m-sequence using generator polynomial [45]
sd1 =[0 0 0 0 1]; % Initial state of Shift register
PN1=[]; % First m-sequence
for j=1:G
PN1=[PN1 sd1(5)];
if sd1(1)==sd1(4)
temp1=0;
else temp1=1;
end
sd1(1)=sd1(2);
sd1(2)=sd1(3);
sd1(3)=sd1(4);
sd1(4)=sd1(5);
sd1(5)=temp1;
end
subplot(3,1,1)
stem(PN1)
title('M-sequence generated by generator polynomial [45]')

%Generation of second m-sequence using generator polynomial [67]
sd2 =[0 0 0 0 1]; % Initial state of Shift register
PN2=[]; % Second m-sequence
for j=1:G
PN2=[PN2 sd2(5)];
if sd2(1)==sd2(2)
temp1=0;
else temp1=1;
end
if sd2(4)==temp1
temp2=0;
else temp2=1;
end
if sd2(5)==temp2
temp3=0;
else temp3=1;
end
sd2(1)=sd2(2);
sd2(2)=sd2(3);
sd2(3)=sd2(4);
sd2(4)=sd2(5);
sd2(5)=temp3;
end
subplot(3,1,2)
stem(PN2)
title('M-sequence generated by generator polynomial [67]')

%Generation of Third m-sequence using generator polynomial [75]
sd3 =[0 0 0 0 1]; % Initial state of Shift register
PN3=[]; % Third m-sequence
for j=1:G
PN3=[PN3 sd3(5)];
if sd3(1)==sd3(2)
temp1=0;
else temp1=1;
end
if sd3(3)==temp1
temp2=0;
else temp2=1;
end
if sd3(4)==temp2
temp3=0;
else temp3=1;
end
sd3(1)=sd3(2);
sd3(2)=sd3(3);
sd3(3)=sd3(4);
sd3(4)=sd3(5);
sd3(5)=temp3;
end
subplot(3,1,3)
stem(PN3)
title('M-sequence generated by generator polynomial [75]')
 

where is the error, i run it on my computer and it's working fine...
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top