need helpin solving this.

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?

Respuestas (3)

Sg dg
Sg dg el 2 de En. de 2013

0 votos

yup.. for me to refer against my current answers.

2 comentarios

Image Analyst
Image Analyst el 2 de En. de 2013
Editada: Image Analyst el 2 de En. de 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
Roger Stafford el 2 de En. de 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?

Iniciar sesión para comentar.

Sg dg
Sg dg el 2 de En. de 2013

0 votos

n= 1:100
n =
Columns 1 through 21
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
Columns 22 through 42
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
Columns 43 through 63
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
Columns 64 through 84
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
Columns 85 through 100
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
>> Xn= ((-1).^n+1)/(2*n-1)
Xn =
0.0076
is this correct?

3 comentarios

José-Luis
José-Luis el 2 de En. de 2013
Editada: José-Luis el 2 de En. de 2013
No. Beware of
* vs .*
and
/ vs ./
Walter Roberson
Walter Roberson el 2 de En. de 2013
The "/" operator is for matrix division. You want ./ which is element-by-element division.
Sg dg
Sg dg el 2 de En. de 2013
Xn= ((-1).^n+1)./(2*n-1)is this correct?

Iniciar sesión para comentar.

Image Analyst
Image Analyst el 2 de En. de 2013

0 votos

Nope. n is a vector so you need ./ rather than /.

5 comentarios

Sg dg
Sg dg el 2 de En. de 2013
errrr.. im kinda confuse now
Sg dg
Sg dg el 2 de En. de 2013
Xn= ((-1).^n+1)./(2*n-1)
correct?
Walter Roberson
Walter Roberson el 2 de En. de 2013
You still need to add up the terms.
Sg dg
Sg dg el 2 de En. de 2013
can u show me? i do nt understand by the terms.
José-Luis
José-Luis el 2 de En. de 2013
Editada: José-Luis el 2 de En. de 2013
doc sum
Example:
a = 1:10;
sum(a)

Iniciar sesión para comentar.

Categorías

Preguntada:

el 2 de En. de 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by