function odsumet

% t=linspace(-5,10,500);
t=linspace(-5,10,500);
x=5-2*t.^2+1/5*t.^3+10*+5*sin(t);
xs=x+10*randn(size(x));
t2=1:length(t);

close all;
f=figure;
set(f,'units','centimeters');
s=2*[21 12.5];
set(f,'position',[1.5 1.2 s]);
set(f,'papersize',s);
set(f,'defaultAxesFontSize',12)

subplot(2,2,1)
plot(t2,x,'linewidth',2);
title('Signal')
legend('Puvodni signal')
xlabel('Cas')
ylabel('Amplituda signalu')
waitforbuttonpress;


subplot(2,2,1)
plot(t2,x,t2,xs,'linewidth',2);
title('Signal')
legend('Puvodni signal','Zasumeny signal')
xlabel('Cas')
ylabel('Amplituda signalu')
waitforbuttonpress;

subplot(2,2,3)
Xs=fft(xs);
plot(abs(Xs),'linewidth',2);

title('Signal ve frekvencni bazi')
xlabel('Frekvence')
ylabel('Amplituda dane frekvence')
legend('Puvodni signal')
waitforbuttonpress;
xlim([0 30])
waitforbuttonpress;

b=11
Xs(b:end-b+1)=0;
hold on
plot(abs(Xs),'linewidth',2);
legend('Puvodni signal','Odsumeny signal')
xlim([0 30])
waitforbuttonpress;


subplot(2,2,2)
y=ifft(Xs);
y=real(y);
plot(t,xs,'linewidth',2);
title('Rekonstrukce signalu')
legend('Zasumeny signal','Rekonstruovany signal')
xlabel('Cas')
ylabel('Amplituda signalu')
hold on 

waitforbuttonpress;
plot(t,y,'linewidth',2);
legend('Zasumeny signal','Rekonstruovany signal')

waitforbuttonpress;
subplot(2,2,4)
plot(t,x,t,y,'linewidth',2);
title('Rekonstrukce signalu')
legend('Puvodni signal','Rekonstruovany signal')
xlabel('Cas')
ylabel('Amplituda signalu')
hold on 




