File Exchange

image thumbnail

GPS C/A Code Generator

version 1.1.0.0 (2.29 KB) by Dan Boschen
Generates C/A Codes for selected PRNs, up to 37 codes.

41 Downloads

Updated 01 Jun 2010

View Version History

View License

G=CACODE(SV,FS)
G is a matrix with 1023*FS columns with a row for each PRN desired.
SV is a vector containing PRN numbers to be generated, from 1 to 37.
FS is the number of samples per chip desired in the code sequence. (Default=1).

Cite As

Dan Boschen (2021). GPS C/A Code Generator (https://www.mathworks.com/matlabcentral/fileexchange/14670-gps-c-a-code-generator), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (17)

Aleksey K

vimal kumar chawda

Hello

1-How one can get if we want to shift sv1= 345 chip , sv2= 23 chip and sv3= 795 chip then after that we want to generate the CA code for the GPS?
sv1=6
sv2=16
sv3=26
just provide me some hint?

vimal kumar chawda

I have change the first line of the code but it is not resulting the answer.

like i need for prn6 prn16 prn 26

so i have change it to
g=cacode([6 12]), in place of g=cacode(sv,fs), may i know sir what went wrong ?

Oleksii Babich

For example to generate the C/A codes for PRN 6 and PRN 12 use:
% g=cacode([6 12]),
% and to generate the C/A codes for PRN 6 and PRN 12 at 5 MHz use
% g=cacode([6 12],5/1.023)

Oleksii Babich

I have the same:
Error in cacode (line 48)
if (max(sv)>37) || (min(sv)<1) || (min(size(sv))~=1)
Can you help me?

Jeffrey Ouellette

Jimmy Petrocini

I have this:

Error in cacode (line 48)
if (max(sv)>37) || (min(sv)<1) || (min(size(sv))~=1)

Can you help me?

Bryce Bolton

Thank you Dan!

Vojtech Ters

Its awesome man :) Thank you,great work ;)

Vl B

ok

AJ Hsu

It is really helpful

Dan Rutherford

Good job,
thanks for the leg up on learning about GPS

Jared Meadows

I think this is a wonderful function. I did encounter an column index error on line 116, and I think it's caused by floating point error when the ceil(cnt) is performed and ceil is ~ L. I was able to correct the problem with the following code:
if ceil(cnt) > L
gfs(:,index)=g(:,L);
else
gfs(:,index)=g(:,ceil(cnt));
end

Thanks for coding up the C/A algorithm.

liu bo

you have done a good job!

liu bo

without think about time clock,use FPGA to produce cacode maybe better.what do you think,Dan Boschen?

George James

I tried to run the code in matlab but I got the following error

Error in ==> cacode at 36
if (max(sv)>37) || (min(sv)<1) || (min(size(sv))~=1)

Pierre Gibouin

Great programm !

MATLAB Release Compatibility
Created with R14SP2
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!