You are on page 1of 1

freq=input('freq')

d=0;
x=(0:0.5:2*pi*freq);
for s=1:2:1000
d=d+(sin(x*s))/s;
end;
plot(x,d);
xlabel('freq');
ylabel('sq wave');

freq=input('freq')
d=0;
x=(0:0.5:2*pi*freq);
for s=1:2:1000
d=d+(sin(x*s))/s;
pause(0.5);
end;
plot(x,d);
xlabel('freq');
ylabel('sq wave');

You might also like