Øving 5 - Fouriertransform - LF Obligatoriske oppgaver See the notes Matlab: %x og t aksen x=:.:pi; t=:pi/:*pi; %sette opp funksjon og plotte hver frame for j=:length(t) %funksjonsverdier p innev rende tidspunkt f=sin(*t(j))*sin(*x); %vi plotter disse funksjonsverdiene plot(x,*f) axis([ pi..]) pause(.3) end Python: import numpy as np import matplotlib.pyplot as plt from matplotlib.animation import FuncAnimation #ok jeg kryper til korset, og innroemmer at jeg ikke skjonner baret av... hvordan denne koden funker. jeg fant den paa nettet, og greide aa... modifisere den akkurat nok til at jeg fikk ut den animasjonen jeg ville ha fig, ax = plt.subplots() ax.set xlabel(r'$x$') ax.set xlabel(r'$y$') xdata, ydata = [], [] ln, = plt.plot([], [], animated=true,label=r'$u\, (x,t)$') # skriv inn 'ro'... som tredje argument hvis du vil ha tilbake punkter i stedet for linjer. def init(): ax.set xlim(, *np.pi) ax.set ylim(.,.) return ln, def update(frame): xdata=np.linspace(, *np.pi, 8) ydata=np.sin(frame)*np.sin(np.linspace(, np.pi, 8)) ln.set data(xdata, ydata) return ln, # Man kan endre hastigheten ved aa endre paa interval parameteren
ani = FuncAnimation(fig, update, frames=np.linspace(, *np.pi, 8),... interval=5, init func=init, blit=true) plt.legend() plt.show() 3 By the definition of Fourier transform we have ˆf(w) = f(x)e dx = e x e dx = e x cos wx dx i e x sin wx dx }{{} = = e x cos wx dx = e x cos wx dx π π [ ] e x = ( cos wx + w sin wx) = π + w π + w. By the definition of inverse Fourier transform we get f(x) = ˆf(w)e iwx dw = π + w eiwx dw. By evaluating this equation wisely at x = we get Thus, = f() = π + w dw = π + x dx = π. 4 Let g(x) = e x. By the differentiation rule, we have Since F {g (x)} = w F {g(x)}. + w dw. g (x) = e x + 4x e x = g(x) + 4f(x), and using the linearity of the Fourier transform, we get 4 F {f(x)} = F {g(x)} + F {g (x)} = F {g(x)} w F {g(x)}. The Fourier transform of g(x) is known to be F {g(x)} = e w /4, so that ˆf(w) = F {f(x)} = w 4 e w /4.
5 We take the Fourier transform of the convolution: F {f g} = F {f} F {g}. Notice that g(x) = f (x), such that (using the derivative of the Fourier transform) F {g} = F {f } = iw F {f}. Using this and F {f} = e w /4, we get F {f g} = ( e w /4 iw Taking the inverse transform yields (f g)(x) = i 4 ) e w /4 = iw π / e w we w / e iwx dw. Anbefalte oppgaver Fourier transform. By the definition of Fourier transform we have Consider first w = ± ˆf(w) = f(x)e dx = π sin xe dx = sin x cos wx dx i sin x sin wx dx π π }{{} = π = i sin x sin wx dx π sin x sin wx dx = ± = ± sin x dx = ± [ x sin x 4 Now, we use the following trigonometric identities and ] π = ± π. cos x sin(α) sin(β) = (cos(α β) cos(α + β)) sin(α + β) = sin(α) cos(β) + cos(α) sin(β). dx
If w ±, we get sin x sin wx dx = (cos[( w)x] cos[( + w)x]) dx = [ ] sin[( w)x] sin[( + w)x] π w + w = ( ) sin[( w)π] sin[( + w)π] w + w = ( sin(πw) w + sin(πw) ) = + w w. Thus, i π w ± w ˆf(w) = i π w = i π w =. The integral. By the definition of inverse Fourier transform we get f(x) = ˆf(w)e iwx dw = i π = i cos wx dw i π w π }{{} = π = sin wx dw. w By evaluating this equation wisely at x = π Thus, ( π ) = f = π we get w eiwx dw sin wx dw w sin(πw) sin(πw/) w dw. sin(πw) sin(πw/) w dw = π. Recall that the Fourier transform of f is given by a) Now gives F(f)(w) := ˆf(w) = f(x) = ˆf(w) = { e x, x >, else f(x)e ixw dx. e x(iw+) dx = + iw.
Thus ˆf(w) = ( + iw). b) Now f(x) = { x, x [, ], else gives Thus ˆf(w) = ( x )e dx = ( x ) dx = ( x ) dx = x dx = x () dx = x e ( ) e () () dx = e + e iw w () 3 dx = 4 cos w w e () 3 = 4 cos w w (e e iw ) iw 3 = 4 cos w w + 4 sin w w 3. ˆf(w) = ( 4 cos w w + 4 sin w ) w 3. c) Now gives ˆf(w) = (T + x)e dx + T T + x, T x < f(x) = T x, x < T, else T (T x)e dx T = (T + x) dx + (T x) dx T = T dx + T T T + dx T = dx dx T = e () T e () T = eit w e it w w = cos T w w.
Thus ˆf(w) = cos T w π w.