The Doppler Effect
作者:
Senan Sekhon
最近上传:
3 年前
许可:
Creative Commons CC BY 4.0
摘要:
Graphic illustrating the Doppler effect with radar speed detection, created in TikZ
\begin
Discover why 18 million people worldwide trust Overleaf with their work.
\begin
Discover why 18 million people worldwide trust Overleaf with their work.
\documentclass[10pt]{extarticle}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[dvipsnames]{xcolor}
\usepackage[utf8]{inputenc}
\usepackage[paperwidth=14cm,paperheight=7.5cm,top=0.5cm,bottom=0.5cm,left=0.5cm,right=0.5cm]{geometry}
\usepackage{tikz,tikzpeople}
\usetikzlibrary{arrows}
\usepackage[most]{tcolorbox}
%Defining a command for a sine wave joining two points
%\wave[options]{x-coordinate of initial point}{y-coordinate of initial point}{x-coordinate of final point}{y-coordinate of final point}{frequency}{amplitude}
\newcommand{\wave}[7][]{
%\fill[red] (#2,#3) circle (1pt) node[right]{i}; %initial point (for visual aid)
%\fill[blue] (#4,#5) circle (1pt) node[right]{f}; %final point (for visual aid)
\pgfmathsetmacro{\len}{sqrt((#4-#2)^2+(#5-#3)^2)} %length of line joining
\pgfmathsetmacro{\angle}{atan2(#5-#3,#4-#2)}
\begin{scope}[shift={(#2,#3)},rotate=\angle,xscale=\len,yscale=#7] %Transformations MUST be in this order to render properly!
\draw[#1] plot[domain=0:1,smooth,samples=300] (\x,{sin(2*pi*#6*deg(\x))}); %the wave
\end{scope}}
%Created by Senan Sekhon
%September 3, 2021
\begin{document}
\definecolor{boxcol}{HTML}{031769} %Box color
\begin{center}
\begin{tcolorbox}[title=The Doppler Effect, fonttitle=\large\sffamily\bfseries\itshape\selectfont,halign title=center,colback=white,colframe=boxcol,coltitle=white,top=0pt,bottom=0pt,left=0pt,right=0pt,toptitle=1pt,bottomtitle=1pt,boxsep=0pt,arc=2mm,hbox]
\begin{tikzpicture}
\clip (-7,-2.6) rectangle (5,2.8);
%\draw (-7,-2.6) rectangle (5,2.8); %Border (optional)
\begin{scope}[scale=1] %Road
\shade[left color=green!10!gray!40!black,right color=green!10!gray!40!black,middle color=green!20!gray!20!black] (-7,-0.5) rectangle (5,0.5); %The road
\foreach \a in {-6,-3,0,3} %lane dividers
\fill[white] (\a-0.3,-0.03) rectangle (\a+0.3,0.03);
\end{scope}
\draw[fill=Cerulean!20,rounded corners=0.4mm] (1.1,0.8)--(1.6,1.1)--(1.7,1.1)--(1.2,0.8); %windshield
\begin{scope}[even odd rule] %Chassis
\clip (0,0) rectangle (6,2) (1,0.3) circle (.35) (3.7,0.3) circle (.35); %clipping wheel cavities out of chassis
\definecolor{fcol}{HTML}{AD5389} %front color
\definecolor{rcol}{HTML}{3C1053} %rear color
\shadedraw[draw=black,left color=fcol,right color=rcol,shading angle=135,rounded corners=2mm] (0.2,0.2)--(0,0.6)--(0.8,0.8)--(1.4,0.8) arc(-105:-75:4)--++(15:0.4) arc(105:60:1.2)--(4.5,0.2)--cycle; %The chassis
\end{scope}
\begin{scope} %Visual aesthetics for the front wheel
\clip (0.6,0.2) rectangle (1.4,0.7);
\draw (1,0.3) circle (.35); %chassis cavity border for front wheel
\clip (0.6,0.25) rectangle (1.4,0.7);
\fill[black] (1,0.3) circle (.35); %dark background behind front wheel
\end{scope}
\begin{scope} %Visual aesthetics for the rear wheel
\clip (3.3,0.2) rectangle (4.1,0.7);
\draw (3.7,0.3) circle (.35); %chassis cavity border for rear wheel
\clip (3.3,0.25) rectangle (4.1,0.7);
\fill[black] (3.7,0.3) circle (.35); %dark background behind rear wheel
\end{scope}
%Front and rear wheels
\fill[gray!50!black] (1,0.3) circle (.3); %front wheel - outer portion
\fill[gray!50!black] (3.7,0.3) circle (.3); %rear wheel - outer portion
\fill[gray!80] (1,0.3) circle (.2); %front wheel - inner portion
\fill[gray!80] (3.7,0.3) circle (.2); %rear wheel - inner portion
\draw[{Latex[scale=0.8]}-,thick] (1.2,-0.7)--(3.5,-0.7) node[scale=1.25,midway,below]{$v$}; %arrow for velocity of car
\begin{scope} %Driver
\clip (1.4,0.793) arc(-105:-75:4)--(2.7,1.6)--(2.3,1.6)--cycle; %clipping driver profile to 'fit' the chassis
\definecolor{scol}{HTML}{19022E} %shirt (blazer) color
\definecolor{ucol}{HTML}{F5C9EF} %undershirt color
\definecolor{tcol}{HTML}{350340} %tie color
\node[name=driver,scale=2,businessman,saturated,mirrored,hair=black,shirt=scol,undershirt=ucol,tie=tcol,monogramtext=\ ] at (2.4,1) {}; %The driver
\end{scope}
%Police officer
\definecolor{pcol}{HTML}{0408A6} %jacket and hat color
\node[name=police,scale=2,police,saturated,hair=black,shirt=pcol,hat=pcol] at (-6,1.6) {}; %The police officer
%%% Waves
%\draw (-5.4,2)--(1,1.6);
%\draw (-5.4,1.5)--(1,1.1);
\wave[-{Latex[scale=0.5]},red]{-5.4}{2}{1}{1.6}{4}{0.2}
\wave[{Latex[scale=0.5]}-,blue]{-5.4}{1.5}{1}{1.1}{8}{0.2}
\path (-5.4,2.4)--(1,2) %labels for transmitted signal
node[midway,sloped,red,font=\sffamily]{transmitted signal}
node[pos=0.03,sloped,red,font=\sffamily] {$f_0$}
node[pos=0.97,sloped,red,font=\sffamily] {$f_1$};
\path (-5.4,1.1)--(1,0.7) %labels for received signal
node[midway,sloped,blue,font=\sffamily]{received signal}
node[pos=0.03,sloped,blue,font=\sffamily] {$f_2$}
node[pos=0.81,sloped,blue,font=\sffamily] {$f_1$};
%Equations for Doppler effect
\node[right,red!70!black,font=\sffamily] at (-6.8,-1) {Transmission: $\displaystyle f_1=\frac{c+v}{c}f_0$};
\node[right,blue!70!black,font=\sffamily] at (-6.8,-1.8) {Reception: $\displaystyle f_2=\frac{c}{c-v}f_1=\frac{c+v}{c-v}f_0$};
\node[right,red!50!blue!70!black,font=\sffamily\bfseries] at (-0.6,-1.8) {Speed detected: $\displaystyle v=\frac{f_2-f_0}{f_2+f_0}c$};
\end{tikzpicture}
\end{tcolorbox}
\end{center}
\end{document}