# Alternative Mathematics using MATLAB 7

### Gunnar Backstrom (view profile)

13 Mar 2003 (Updated )

Self-instructive text on undergraduate algebra, statistics, differential and integral calculus.

ex255.m
% ex255.m:  Direct and Inverse Fourier Transforms
clear all
ns=101;                		% Number of samples for function
A=1;  a=50;          		% Constant for function
tlim=10*a;                    		% Time range
dt=2*tlim/(ns-1);            	% Time increment
T=-tlim: dt: tlim;
F=A*T.*exp(-T.^2/a^2);      	% Modified Gaussian function
figure(1),  plot(T,F),  grid on,  xlabel('t'),  ylabel('target function f(t)')
Nu=linspace(-2/a, 2/a, 100);
G=sft(T, F, Nu);       		% Simple Fourier transform
figure(2),  plot( Nu,real(G),'o',  Nu,imag(G),'*'),  grid on
xlabel('frequency'),  ylabel('real(G)=o,  imag(G)=* ')

Ft=isft( Nu, G, T);           	% Inverse transform
figure(3),  plot( T,real(Ft),'o',  T,imag(Ft),'*',  T,F),  grid on;
xlabel('t'),  ylabel('inverse transform Ft and original F (curve)')
figure(4),  plot( T,real(Ft)-F,'o'),  grid on
xlabel('t'),  ylabel('difference Ft-F')