
# Omniyagi
<sub>Disclaimer: This is just an opinion.</sub>
## Introduction

The usual omnidirectional antenna has a radiation pattern of:  
<br>
<img width="50%" style="margin-left:50%"  src="https://www.mpantenna.com/wp-content/uploads/2019/09/high-gain-omni-pattern-300x282.png"/>
<br><br>
The usual yagi antenna has a radiation pattern as shown in:  
 <br>  
<img width="50%" style="margin-left:50%" src="https://external-content.duckduckgo.com/iu/?u=http%3A%2F%2Fwww.raymaps.com%2Fwp-content%2Fuploads%2F2012%2F02%2FYagi-Antenna-3D-Radiation-Pattern.jpg&f=1&nofb=1&ipt=fe9716b06b1dcb895fc304ee63e020191fc69416890aca1aecc2fe073115926c&ipo=images"/>
<br>
<br>

  
For the sake of simplicity, assume these simplifications of said radiation patterns to be true(within the thought experiment).
  

<img width="45%" src="images/omni.png" style="margin:3.5%"  />  <img width="45%" src="images/yagi.png"/>


## Problem
A radio signal generator is constantly transmitting from an unknown location and the most precise approximation is needed. We have two strategies at our disposal - one for each of the aforementioned antennas respectively.

### Omnidirectional Strategy(ODS)

Let `A` be the antenna and the center of the reception circle. The reception circle's radius is 2 units. These units have an unknown real life equivalent(you can imagine it as gain); However that is rather irrelevant for the scope of the experiment. The point `A` can be moved around the plane freely.

### Yagi strategy(YS)

Let `A,B,C` and `D` be individual directional antennas ordered in a rectangular formation. Each antenna has a vector with the length of 10, given that directional antennas usually have around 5 times higher gain when receiving and transmitting signal than omnidirectionals, the cost of that being that the transceiving is limited to a certain direction. The formation must be composed in a way, such that there is always at least 2 vectors intersecting each other. These points are stationary, however their respective vectors could be rotated 360 degrees.
We know the distances between each of the points.

### Solution approach

Both strategies involve direction finding of some sort. [Direction finding](https://en.wikipedia.org/wiki/Direction_finding) using vector intersection is quite self explanatory, you take the antenna in which the signal is the strongest, take the two nearest antennas and find the point in which the vectors overlap. The point left at the end is our location.
  
<img style="margin-left:50%"  width="50%" src="https://upload.wikimedia.org/wikipedia/commons/thumb/c/cd/Triangulation.svg/800px-Triangulation.svg.png"/>

When it comes to circles, however, the strategy is different. [Trilateration](https://en.wikipedia.org/wiki/Trilateration) is a way of pinpointing a location using ranges. The approach is different from the usual, as we do not have multiple antennas, but rather a single moving one. Trilateration goes like: Get readings from 3 different points(it would help if they were polar opposites). Find the intersection of the three circles that you have. That's the point we're looking for.

<img style="margin-left:50%"  width="50%" src="https://www.researchgate.net/profile/Constantinos-Patsakis/publication/277077361/figure/fig1/AS:613444243968081@1523267913923/Trilateration-attack-with-exact-distances.png"/>

### Expected results
YS is not as effective, however it is way more efficient than ODS on many levels. At least on paper. A list of all the theoretical pros of YS over ODS:

```
1. Is not affected by temporary intermissions(like static and weather conditions) as much, given that all of the readings are taken simultaneously.
2. The setup is permanent and does not require movement, which permits consistent results.
3. Result is certain, given that the point is within the rectangular formation.
4. The math is way easier.
```
That is not to say that ODS does not have pros:

```
1. Less investment when it comes to money/time in the scope of the setup(as you *could* build Yagi antennas yourself).
2. More fun in the moment of taking readings.
3. Possibly more fun if you like complicated math.
```

### Simulation results

#### Small-scale simulations  

Disclaimer: These simulations are **seriously** half-assed.

##### Yagi simulation
<img style="margin-left:50%"  width="50%" src="images/yagi.gif"/>  
  
This is the simulation of one of the aforementioned strategy. We can take from it that, if the location we are looking for is inside of the area of the rectangle formed by connecting the antenna points, or even slightly outside - we will find it. I would say in a rather rapid manner(depending on the speed of spinning).

##### Omnidirectional simulation
<img style="margin-left:50%"  width="50%" src="images/omni.gif"/>  
  
Would you look at that. Fueled by pure pseudorandomness, this "algorithm" is blowing the competition away. Imagine if there was a real algorithm that got closer and closer! As you can see, it takes a lot less time(given you can teleport) to cover the entirety of the rectangular area we have. But what about, scaling things up a bit...  

  
<sub>(CLIFFHANGER WOOOOOOOOOOO((i'm gonna finish this later))).</sub>
  

### Sources

##### Articles
1. [Direction finding](https://en.wikipedia.org/wiki/Direction_finding) 
2. [Trilateration](https://en.wikipedia.org/wiki/Trilateration) 
3. [Triangulation](https://en.wikipedia.org/wiki/Triangulation)   
4. [Yagi-Uda antenna](https://en.wikipedia.org/wiki/Yagi%E2%80%93Uda_antenna)  
5. [Omnidirectional antenna](https://en.wikipedia.org/wiki/Omnidirectional_antenna) 
##### Images
1. Wikimedia
2. Researchgate
3. Raymaps.com

Graphs made with GeoGebra

