GIBBS phenomenon 

Aim: To verify the Gibbs Phenomenon.

EQUIPMENTS:

PC with windows (95/98/XP/NT/2000).

MATLAB Software.

Theory:


Gibbs Phenomenon Program :

t=0:0.1:(pi*8);
y=sin(t);
subplot(5,1,1);
plot(t,y);
xlabel('k');
ylabel('amplitude');
title('gibbs phenomenon');
h=2;
%k=3;
for k=3:2:9
y=y+sin(k*t)/k;
subplot(5,1,h);
plot(t,y);
xlabel('k');
ylabel('amplitude');
h=h+1;
end

Output:

Program-2:

f=input('enter the sampling frequency')
T=input('enter the duration over which the wave is to be plotted')
t=linspace(0,T,f);
p=zeros(1,length(t));
q=p;
for i=1:length(t)/2
   p(i)=1;
   p(i+(length(t)/2))=-1;
end
n=input('enter the number of sinusoids')
for i=0:n-1
   k=1/(2*i+1);
for j=1:length(t)
   q(j)=(q(j)+(4/pi)*k*sin((1/k)*t(j)));
end
end
plot(t,p,'r',t,q,'k')
xlabel('time')
ylabel('Amplitude')
title(['Rectangular Pulse','Sinusoidal Signals'])
title('f=1000 and Number of Sinusoids=')

RESULT:

enter the sampling frequency    1000

enter the duration over which the wave is to be plotted     2*pi

enter the number of sinusoidal    1

 

enter the sampling frequency    1000

enter the duration over which the wave is to be plotted     2*pi

enter the number of sinusoidal    2

 

enter the sampling frequency    1000

enter the duration over which the wave is to be plotted     2*pi

enter the number of sinusoidal    3

enter the sampling frequency    1000

enter the duration over which the wave is to be plotted     2*pi

enter the number of sinusoidal    6

enter the sampling frequency    1000

enter the duration over which the wave is to be plotted     2*pi

enter the number of sinusoidal    10

enter the sampling frequency    1000

enter the duration over which the wave is to be plotted     2*pi

enter the number of sinusoidal    50

Result: In this experiment Gibbs phenomenon have been demonstrated Using MATLAB.