need helpin solving this.
Afficher commentaires plus anciens
create a vector X with the elements,
add up the element of the version of this vector that has 100 elements.
thanks for the help.
n= 1:100
Xn= ((-1).^n+1)/(2*n-1)
Xn =
0.0076is this correct?
1 commentaire
per isakson
le 2 Jan 2013
Homework?
Réponses (3)
Sg dg
le 2 Jan 2013
0 votes
2 commentaires
Image Analyst
le 2 Jan 2013
Modifié(e) : Image Analyst
le 2 Jan 2013
You go first. You can do this in two lines of MATLAB code. What were they and what were your "current answers"? Then we can tell you if you were correct.
Roger Stafford
le 2 Jan 2013
As you near the end of your one hundred terms your sum ought to be oscillating roughly equal distances on either side of pi/4. Does that help?
Sg dg
le 2 Jan 2013
3 commentaires
No. Beware of
* vs .*
and
/ vs ./
Walter Roberson
le 2 Jan 2013
The "/" operator is for matrix division. You want ./ which is element-by-element division.
Sg dg
le 2 Jan 2013
Image Analyst
le 2 Jan 2013
0 votes
Nope. n is a vector so you need ./ rather than /.
5 commentaires
Sg dg
le 2 Jan 2013
Sg dg
le 2 Jan 2013
Walter Roberson
le 2 Jan 2013
You still need to add up the terms.
Sg dg
le 2 Jan 2013
doc sum
Example:
a = 1:10;
sum(a)
Catégories
En savoir plus sur Matrix Indexing dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!