Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

Translate the entire conversation 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

2 REPLIES 2

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