필터 지우기
필터 지우기

Anti-spoofng algorithm design from the block diagram

조회 수: 13 (최근 30일)
zihan LI
zihan LI 2022년 3월 10일
답변: Ravi 2024년 1월 25일
I am currently working on designing an anti-spoofing algorithm, but I don't know how to write the code according to this block diagram from a literature. Would someone help me with it, how to transfer these information into coding or how to draw this block diagram on SIMULINK?
  댓글 수: 2
Peter O
Peter O 2022년 3월 10일
Can you post the block diagram?
zihan LI
zihan LI 2022년 3월 10일
Oh I am so sorry i fogot this important part.

댓글을 달려면 로그인하십시오.

답변 (1개)

Ravi
Ravi 2024년 1월 25일
Hi Zihan LI,
We can define a function that takes input the signals data ‘S’, the sampling number ‘N’, and the error threshold, ‘epsilon’. Here, S(i, k) represents the carrier frequency of the ith signal at the kth time slot.
Please note that MATLAB uses one-based indexing.
From the first flow chart, we can observe the following.
  1. Relative discrepancies are computed.
  2. Difference between relative discrepancies for every two signals ‘i', and ‘j’ at every time slot ‘k’ is calculated.
  3. For every pair of signals, the count of the number of time slots for which the relative difference falls with the threshold is maintained.
  4. If the count exceeds 2N/3, they are marked as spoofed signals.
The code for the first flow chart looks as follows:
function pair = spoofed(S, N, epsilon)
pair = [];
S_cap = abs(S(:, :) - S(:, 1));
for i = 1:N
for j = 1:N
Nij = 0;
for z = 1:N
diff = abs(S_cap(i, z) - S_cap(j, z));
if diff < epsilon
Nij = Nij + 1;
end
end
if Nij > (2 * N / 3)
disp('signal ' + num2str(i) + ' and signal ' + num2str(j) + ' are spoofed');
pair = [i, j];
end
end
end
end
In the second flow chart, we are computing the sum of squares of relative differences for every pair of signals at each time slot, and checking if the sum falls below the threshold. The code for the second flow chart looks as follows:
function pair = spoofed(S, N, epsilon)
S_cap = abs(S(:, :) - S(:, 1));
for i = 1:N
for j = 1:N
x = S_cap(i, :) - S_cap(j, :);
Eij = sum(x.*x);
if Eij < epsilon
disp('signal ' + num2str(i) + ' and signal ' + num2str(j) + ' are spoofed');
pair = [i, j];
end
end
end
end
I hope this answer helps!

카테고리

Help CenterFile Exchange에서 Simulink에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by