I've started to learn signal fundamentals and I have to do one exercise and I can't understand something.
It is said that $$x[n]=3\cos(0.1 \Pi n)(u[n+55]-u[n-55]))$$ and that the signal $u[n-m]$ is a unit step with the value $0$ for $n<m$ and $1$ for $n\geq m$
I have made this MatLab function to plot this signal.
function x = signal(n)
% n is passed as n = -100:100;%
x = zeros(1,length(n));
for i=1:length(n)
if n(i)>-55 && n(i) < 55
x(i) = 3*cos(0.1*pi*n(i));
else
x(i) = 0;
end
end
end
Is this OK? I'm having doubt's because I can't understand what $(u[n+55]-u[n-55]))$ means...
You gave the definition of $u[n]$ in your post: $u[n]=\begin {cases} 0 & n \lt 0 \\ 1 &n \ge 0 \end {cases}$ Using that $u[n-55]=\begin {cases} 0 & n \lt 55 \\ 1 &n \ge 55 \end {cases}$ and $u[n+55]=\begin {cases} 0 & n \lt -55 \\ 1 &n \ge -55 \end {cases}$