Friday 4 March 2011

matlab code for a rectangular pulse..


%t=0:.1:10

x=[ones(10,1);zeros(90,1)];
%stem(x)

y=abs(fft(x))
f = (0:length(x)-1)*99/length(x);
subplot(2,2,1)
plot(y)
z=angle(fft(x))
f = (0:length(x)-1)*99/length(x);
subplot(2,2,2)
plot(f,z)

subplot(2,2,[3,4])
stem(x)
%axis([-10 100 0 2])

No comments:

Post a Comment