image thumbnail

Waveform Generator GUI 2

by

 

22 Feb 2012 (Updated )

Generate waveformed signal and play it. Interactive GUI with movable datapoints.

[a b]=calulate_harmonics(nh,T,x,y,cs,sn)
function [a b]=calulate_harmonics(nh,T,x,y,cs,sn)
a=zeros(1,nh+1);
b=zeros(1,nh+1);
a(1)=(2/T)*trapz(x,y);
b(1)=0;

for nhc=1:nh
    %a(nhc+1)=(2/T)*trapz(x,y.*cos(nhc*(2*pi/T)*x));
    %b(nhc)=(2/T)*trapz(x,y.*sin(nhc*(2*pi/T)*x));
    a(nhc+1)=(2/T)*trapz(x,y.*cs(nhc,:));
    b(nhc+1)=(2/T)*trapz(x,y.*sn(nhc,:));
end

Contact us