- Draw out the
**Reflection**and**Trasmission**. - Derive the
**phase shift**in complex condition.

# Before we begin

This is the first time that I write a blog in English, please forgive me if there is any wrong and tell me if you like. :)

Then let’s begin.

I suppose that we have already know those equations.

## Fresnel Equations

## Snell Law

# Draw $r$, $t$, and *phase shift* by MATLAB

# More

## Phase shift formula

By `Snell's Law,`

we can change in this form,

If $n_t

By Fresnel Equations,

Because $\sin\theta_t$ is complex, it can change in this shape.

Combine two forms of $\tilde{r}_\perp$,

~~Observe the equations above and half-angle formula~~ (After Google),

we can find out,

The same, we can derive

Thus, the Phase Shift between vertical and parallel is

### Confirm

Compare the formula derived above and the `angle()`

function in MATLAB, two curve overlap (blue and red), thus confirm that the formula is correct.

### Something more

At first, I plot the figure directly,

`1` | `phi_v = 2*atan((sin(theta_i).^2 - n_ti^2).^0.5 ./ cos(theta_i));` |

`2` | `plot(theta_i, phi_v);` |

but find warning that plotting complex.

`1` | `警告: 复数 X 和/或 Y 参数的虚部已忽略` |

Go back to see the formula

Plot $(\sin ^{2} \theta_{i}-n^{2}_{ti})$ merely, which is yellow (or green?) curve in the figure above, before the **critical angle** (the zero point of the curve), it is negative. Therefore, $\varphi_\perp$ will be a complex before the critical angle. So we should code it like this

`1` | `plot(theta_i, real(phi_v));` |

The code will be a bit more beautiful with no warning though it will not change the figure.

## Thinking

Why would the $t$ bigger than 1 when $n_i>n_t$, does it still comply with

**conversation of energy**?Maybe in the light of the

**Dielectric coefficient**difference, $\epsilon_i > \epsilon_t$, to keep the**energy density**$u$ to be constant, $E_t$ will be smaller than $E_i$.When $n_i>n_t$, it is

**Total internal reflection**after the**critical angle**, but why does $t\neq 0$ but even $t>1$?Those equations just consider near the boundary, $t$ just go like the figure near the boundary and when it goes away from the boundary, it will decreass rapidly to 0.

Why use complex mode when plotting $r$ and $t$?

Mode represent the size.

Why use

`abs()`

when plotting phase shift?Actually is the difference between ‘A to B’ and ‘B to A’, and because of its periodicty, there is no difference between $\pi$ and $-\pi$.

*Thanks Probfia very much for answering $Q_1$ and $Q_2$!*