__Problem:__Consider a periodic, with period unity, signal with a cycle that is square cornered pulse of width w with an amplitude of a and a middle of m. Use numeric Matlab to plot several cycles of the periodic signal for various values of the cycle parameters.

Here's my code:

Rich (BB code):

```
%--------------
dt=.01;t=-5:dt:5;f=-1/2:dt:1/2; % Time & Freq Vectors
a=2;w=4; % Parameters: a=amplitude, w=width
boxa = ...
(a*1) .* (abs(t)<w/2) + ...
(0) .* (2>=abs(t)>w/2);
eboxa=dt*boxa*boxa';boxa=boxa/sqrt(eboxa); % Energy of box
pboxa=(abs(boxa).^2)/eboxa; % Density of box
mboxa=dt*sum(t.*pboxa); % Middle of box
plot(t,box)
```

Can someone please help me?