Need help with a forloop..

Discussion in 'Programmer's Corner' started by Judas543, Apr 19, 2010.

  1. Judas543

    Thread Starter Member

    Jan 26, 2010
    60
    0
    Use a “for” loop to create a vector with nth element 1+(-1)n+1/(2n+1), and plot it for n=1 to n=10. Label the x-axis “frequency (w)” and the y-axis “phase (f)”. To get “w” use “\omega”; how do you think you get f?
     
  2. johndoe45

    Member

    Jan 30, 2010
    364
    1
    i'm guessing he just wants you to make the loop

    n=1:10;
    for i=1:length(n)
    v(i)=1-n(i)+1/(2*n(i)+1)
    end
    plot(n,v)
    xlabel('frequency (\omega)')
    ylabel('phase (f)')
     
  3. Judas543

    Thread Starter Member

    Jan 26, 2010
    60
    0
    ah i see thank you very much!
     
Loading...