Index exceeds the number of array elements (1).
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
LaChelle McMahan
il 12 Dic 2020
Commentato: SHIVAM KUMAR
il 12 Dic 2020
clear all;
Rj=(1:1:30);
Pj= 1; %Power in Watts
Gj= 1; %Gain of antenna of jammer
c=3*10^8; %Speed of Light
f= 1575*10^9 ;
Lamda=c/f;
Graj= 0.5; %Gain of GPS receiver
BBW= 50; %Baswband Signal Bandwidth in Hz
Lr= 1.58; %Atmospheric losses
SSBW= 10230000; %Spead Spectrum Bandwidth in Hz
DZ= -162;
p=pi;
for a = length(Rj)
Pgj(a+1) =((Pj*Gj)/(4*p(Rj)^2))*((Lamda^2*Graj)/(4*p))*(1/Lr)*(BBW/(2*SSBW));
end
plot(Rj,10*log10(Pgj), Rj,DZ);
title({'GPS Jamming Power in dBW vs Range in km'});
ylabel('Power dBW');
xlabel('Range(km)');
legend('10*Log (Pgj)','Denial Zone = - 162dB');
Hello I keep getting this error. I'm not sure how to fix. Any guidance would be greatly appreciated.
2 Commenti
SHIVAM KUMAR
il 12 Dic 2020
Telling the line number where this error occurs will make it easier to debug.
Risposta accettata
SHIVAM KUMAR
il 12 Dic 2020
Modificato: SHIVAM KUMAR
il 12 Dic 2020
I run it with adding 1 more dot before division . this runs and plots the graph though I am not sure if everything is working fine. And make DZ a array to plot that correctly.
In case its correct accept the answer and close this thing.
clear all;
Rj=(1:1:30);
Pj= 1; %Power in Watts
Gj= 1; %Gain of antenna of jammer
c=3*10^8; %Speed of Light
f= 1575*10^9 ;
Lamda=c/f;
Graj= 0.5; %Gain of GPS receiver
BBW= 50; %Baswband Signal Bandwidth in Hz
Lr= 1.58; %Atmospheric losses
SSBW= 10230000; %Spead Spectrum Bandwidth in Hz
DZ= -162.0*ones(1,30);
p=pi;
%remove the loop its not actually needed .
%I hope you used (Rj)^2 to square each of its elements and not the matrix so use a dot operator to make matlab do that
Pgj =((Pj*Gj)./(4*p*(Rj).^2))*((Lamda^2*Graj)/(4*p))*(1/Lr)*(BBW/(2*SSBW));
plot(Rj,10*log10(Pgj), Rj,DZ);
title({'GPS Jamming Power in dBW vs Range in km'});
ylabel('Power dBW');
xlabel('Range(km)');
legend('10*Log (Pgj)','Denial Zone = - 162dB');
2 Commenti
Più risposte (1)
SHIVAM KUMAR
il 12 Dic 2020
Modificato: SHIVAM KUMAR
il 12 Dic 2020
What I guessed it you didn't use the loop properly
clear all;
Rj=(1:1:30);
Pj= 1; %Power in Watts
Gj= 1; %Gain of antenna of jammer
c=3*10^8; %Speed of Light
f= 1575*10^9 ;
Lamda=c/f;
Graj= 0.5; %Gain of GPS receiver
BBW= 50; %Baswband Signal Bandwidth in Hz
Lr= 1.58; %Atmospheric losses
SSBW= 10230000; %Spead Spectrum Bandwidth in Hz
DZ= -162;
p=pi;
%remove the loop its not actually needed .
%I hope you used (Rj)^2 to square each of its elements and not the matrix so use a dot operator to make matlab do that
Pgj =((Pj*Gj)/(4*p*(Rj).^2))*((Lamda^2*Graj)/(4*p))*(1/Lr)*(BBW/(2*SSBW));
plot(Rj,10*log10(Pgj), Rj,DZ);
title({'GPS Jamming Power in dBW vs Range in km'});
ylabel('Power dBW');
xlabel('Range(km)');
legend('10*Log (Pgj)','Denial Zone = - 162dB');
4 Commenti
Vedere anche
Categorie
Scopri di più su Matrix Indexing in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!