cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

For loop with matrix

NM_10165576
13-Aquamarine

For loop with matrix

hello everyone,
i am trying to get 'z' as matrix as shown in the attached Mathcad 10 sheet.
i do not know where it is going wrong
could someone help me here

ACCEPTED SOLUTION

Accepted Solutions
ttokoro
20-Turquoise
(To:NM_10165576)

2 REPLIES 2
ttokoro
20-Turquoise
(To:NM_10165576)

image.pngimage.png

Werner_E
25-Diamond I
(To:NM_10165576)

As ttkoro has shown, you have forgotten the vector index at z and you had put the increment of i outside and after the loop. So actually you applied the calculation six times to the first vector element and then you got this single value as your result.

 

But why not simply

Werner_E_1-1723181980982.png

 

If you insist on using a loop, you could do it a bit shorter like this

Werner_E_0-1723182239506.png

Note the that local variable in the program must not have the same name as the variable you intend to assign the result to. But of course there is nothing wrong if you use a local variable "z" instead of  "Result".

 

Announcements

Top Tags