- #1
gryphon1221
- 9
- 0
Hello, I am taking a class on GPS navigation. Our homework is to construct a signal based on 10 initial condition values and use modelo-2 arithmetic to get each subsequent value. I have gotten this to work. However, I am only able to see the final 10 values the way I have it set up. I am trying to find a way to store each "k" value before the next iteration begins so that I will have a vector of all the values. I have it set up for 32 iterations, but eventually need about 7000 so an automatic process is necessary. Here is my code:
[k10]=input('Enter the value of intial k-10: ');
[k9]=input('Enter the value of initial k-9: ');
[k8]=input('Enter the value of initial k-8: ');
[k7]=input('Enter the value of initial k-7: ');
[k6]=input('Enter the value of initial k-6: ');
[k5]=input('Enter the value of initial k-5: ');
[k4]=input('Enter the value of initial k-4: ');
[k3]=input('Enter the value of initial k-3: ');
[k2]=input('Enter the value of initial k-2: ');
[k1]=input('Enter the value of initial k-1: ');
%k1-k10 represent the initial condition the 10 chips used to construct
%different PRN numbers.
%For PRN 22: k10=1, k9=1, k8=0, k7=0, k6=1, k5=1, k4=1, k3=1, k2=1, k1=1
%For PRN 27: k10=0, k9=0, k8=1, k7=1, k6=1, k5=1, k4=1, k3=1, k2=1, k1=1
N=32;
count=1;
%N is the maximum number of iterations requested and counts each iteration
%in increments of 1.
while count<=N
if k6+k9==1
k=1;
elseif k6+k9==2
k=0;
elseif k6+k9==0
k=0;
end
%This if-else statement resolves the modulo-2 arithmetic requirement for
%the PRN generator.
k10=k9;
k9=k8;
k8=k7;
k7=k6;
k6=k5;
k5=k4;
k4=k3;
k3=k2;
k2=k1;
k1=k;
%The above equalities represent the Linear Feedback Shift Register. Note
%that, after each iteration, the values shift from a position of k-j to a
%position of k-j-1 until the value falls off after the k-10 position.
count=count+1;
%count=count+1 moves each moves the count to the next iteration, ending at
%N iterations.
end
Thanks for any help. This is killing me.
[k10]=input('Enter the value of intial k-10: ');
[k9]=input('Enter the value of initial k-9: ');
[k8]=input('Enter the value of initial k-8: ');
[k7]=input('Enter the value of initial k-7: ');
[k6]=input('Enter the value of initial k-6: ');
[k5]=input('Enter the value of initial k-5: ');
[k4]=input('Enter the value of initial k-4: ');
[k3]=input('Enter the value of initial k-3: ');
[k2]=input('Enter the value of initial k-2: ');
[k1]=input('Enter the value of initial k-1: ');
%k1-k10 represent the initial condition the 10 chips used to construct
%different PRN numbers.
%For PRN 22: k10=1, k9=1, k8=0, k7=0, k6=1, k5=1, k4=1, k3=1, k2=1, k1=1
%For PRN 27: k10=0, k9=0, k8=1, k7=1, k6=1, k5=1, k4=1, k3=1, k2=1, k1=1
N=32;
count=1;
%N is the maximum number of iterations requested and counts each iteration
%in increments of 1.
while count<=N
if k6+k9==1
k=1;
elseif k6+k9==2
k=0;
elseif k6+k9==0
k=0;
end
%This if-else statement resolves the modulo-2 arithmetic requirement for
%the PRN generator.
k10=k9;
k9=k8;
k8=k7;
k7=k6;
k6=k5;
k5=k4;
k4=k3;
k3=k2;
k2=k1;
k1=k;
%The above equalities represent the Linear Feedback Shift Register. Note
%that, after each iteration, the values shift from a position of k-j to a
%position of k-j-1 until the value falls off after the k-10 position.
count=count+1;
%count=count+1 moves each moves the count to the next iteration, ending at
%N iterations.
end
Thanks for any help. This is killing me.