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

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

For loop with matrix

NM_10165576
7-Bedrock

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

1 ACCEPTED SOLUTION

Accepted Solutions
ttokoro
20-Turquoise
(To:NM_10165576)

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

image.pngimage.png

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".

 

Top Tags