# matlab for loop help.. NO idea where to start..

• Mar 16th 2010, 06:54 PM
Mathhelpz
matlab for loop help.. NO idea where to start..
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?

I know how to label plots and stuff now, but how do I do the first part.. Use a for loop to create a vector with nth element .... from above?

If someone could solve this i will be really grateful!
• Mar 16th 2010, 07:20 PM
dedust
Quote:

Originally Posted by Mathhelpz
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?

I know how to label plots and stuff now, but how do I do the first part.. Use a for loop to create a vector with nth element .... from above?

If someone could solve this i will be really grateful!

Code:

for i=1:5     v(i)=1 end
it'll produce a vector $v$ with all entries is 1