Question: a) Now let modify the code (shown below) to plot x0, x1, x3, x10, x50, x100, x200, x400, x1000. You will need to edit line

a)

Now let modify the code (shown below) to plot x0, x1, x3, x10, x50, x100, x200, x400, x1000. You will need to edit line 8 and line 13. Increase 16 to 1001 (line 8) and manually type the numbers in N=[ ] vector. Run the code and examine the figure. Did you expect the plots to look like they are? Use zoom to examine the corners of the signal. Please comment on the Gibbs phenomena amplitude, frequency.

c)

Now let increase the time sampling from 1,000 to 10,000 (line 6). Run the code again, and see if your comments in part (b) are still valid.

Matlab Code:

%

% Synthesis of a rect waveform

%

%x = inline('mod(t+pi/2,2*pi)<=pi');

t = linspace(-2*pi,2*pi,1000);

x = mod(t+pi/2,2*pi)<=pi;

sumterms = zeros(16,length(t)); sumterms(1,:) = 1/2;

for n = 1:size(sumterms,1)-1;

sumterms(n+1,:) = (2/(pi*n)*sin(pi*n/2))*cos(n*t);

end

x_N = cumsum(sumterms); figure(1); clf; ind = 0;

for N = [0,1:2:size(sumterms,1)-1],

ind = ind+1; subplot(3,3,ind);

x=x*1;

plot(t,x_N(N+1,:),'k',t,x,'k-'); axis([-2*pi 2*pi -0.2 1.2]);

xlabel('t'); ylabel(['x_{',num2str(N),'}(t)']);

end

output=x_N;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!