function z=ptime(pmatrix,pos) % This function computes the time domain representation of a periodic waveform % from its spectral components at a given position. The output is a vector % which contains the amplitude of waveform as a function of a scaled time % (omega*tau) which runs from -pi to pi. % % by Ronald Kumon, 2 Dec 1995 % Declare global variables global a n nhar % Form waveform Nsteps=50; step=2*pi/Nsteps; %z=zeros(1,Nsteps+1); index = 1; pvec =pmatrix(pos,:); Avec =real(pvec); Bvec =-imag(pvec); for y=-pi:step:pi compvec =Avec.*cos(n*y)+Bvec.*sin(n*y); z(index)=sum(compvec); index=index+1; end