% Aufgabe 9.4 Darstellung der Meyerfensters

function y=aufgabe94(x)
 clf reset
 clc
 clear all;
 close all;
 echo off

if nargin == 0
   z=-10:0.02:10;

   for j=0:1000 z1(j+1)=Vmyfun(-10+j/50); end;
   figure
   plot(z,z1);
    set(gca,'FontSize',15);

	for j=0:1000 z1(j+1)=Vmyfun2(-10+j/50); end;
	figure	
   plot(z,z1);
    set(gca,'FontSize',15);
	
	for j=0:1000 z1(j+1)=wave1(-10+j/50); end;
	figure	
   plot(z,z1);
    set(gca,'FontSize',15);
	
	for j=0:1000 z1(j+1)=wave2(-10+j/50); end;
	figure	
   plot(z,z1);
    set(gca,'FontSize',15);

else
	y=Vmyfun(x);
end;	
	

function y1=Vmyfun(z)
if abs(z)<=2*pi/3 y1=1;
elseif abs(z)>4*pi/3 y1=0;
elseif (abs(z)>2*pi/3) & (abs(z)<=4*pi/3) y1=cos((3*abs(z)/(2*pi)-1).*pi./2);
end;

function y1=Vmyfun2(z)
if abs(z)<=2*pi/3 y1=1;
elseif abs(z)>4*pi/3 y1=0;
elseif (abs(z)>2*pi/3) & (abs(z)<=4*pi/3) y1=cos(poly(3*abs(z)/(2*pi)-1).*pi./2);
end;

function y2=poly(x)
y2=x^4*(35-84*x+70*x^2-20*x^3);

function y1=wave1(z)
y1=[Vmyfun(z+2*pi)+Vmyfun(z-2*pi)]*Vmyfun(z/2);

function y1=wave2(z)
y1=[Vmyfun2(z+2*pi)+Vmyfun2(z-2*pi)]*Vmyfun2(z/2);