Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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...

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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}$

share|improve this answer
    
Thanks. I think I now understand. With your explanation I've made some test calculations on the "limits" and I think the for loop has to be if n(i)>=-55 && n(i) < 55 instead of if n(i)>-55 && n(i) < 55 Am I right? –  Favolas Feb 23 '13 at 16:38
    
@Favolas: that is correct. –  Ross Millikan Feb 23 '13 at 21:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.