Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
Hi there
I have a problem with this function . The issue is R is a cumulative value so the R2=R0+R1>
R3= R0+R1+R2 and so on... I wanted to implement that in this function but an error ( must be a vector ) shows
Is there a way to fix this or to write it differently
Thanks
The sheet is attached prime 11
Solved! Go to Solution.
Hi Werner
Is this value calculating the sum of the layers before?
Thanks
@YA_10963798 wrote:
Hi Werner
Is this value calculating the sum of the layers before?
I have no idea WHAT this expression calculates, but it definitely calculates a sum of products of values based on previous R-calculations. We are calculating Ri+1, so Ri already exists as long as we define R1 somewhere in front of the loop.
You original approach
would not have calculated any sum (apart from the fact that it tried to use value not even existing at the time of calculation). Mi and Ri are simple scalar values and so is their product. There is nothing to sum up.
It's like writing
There is nothing to sum up (would need vectors, not scalars) and Prime even throws an error in that case (I would have expected the result 12).
Thank you ... you are a legend
You'll have to check if the indices (i and i+1) of the vectors sigma', dz, gamma, etc. still are correct. Lacking experience in your field of work obviously I can't do so.
Maybe you manually calculate the necessary first few values the hard way and compare if they match Prime's results.
As you tried to make that calculation ORIGIN-independent, you may replace the n=1 in the sum by n=ORIGIN.
I also noticed that you used the absolute value (actually the norm) around the second factor in your calculation, while the picture to the right of if (which you seem to try to duplicate) does not show anything like that!? If I replace the norm by a normal pair of parentheses we get different results and some of them are also negative. Not sure if the norm was done on purpose...
I see your point ...put in my sheet the origin is also one not zero. Why such difference occur?
You are correct I'm trying to duplicate the image to the right where ( i) is the layer of interest and (j) should be also the layer above the layer of interest. However the first layer has zero stress and I do have to include it in the calculation so I used ( i) as the layer above the layer of interest and (i+1) as the layer of interest.
Now for ( R*M) they should be the sum of values of ( R.M) in the layers above the layer of interest.
The end results of (f) should be between zero and one . I don't think having negative values is correct .
But I didn't understand why writing n=1 is different than n=origin when the origin in the sheet is 1
n=1 is NOT different from n=ORIGIN because, as you noted yourself, you have set ORIGIN=1 in your sheet.
I just suggested to use ORIGIN instead of 1 because I saw that you used ORIGIN instead of 1 in other places as well so that the calculations should be independent on the actual setting of ORIGIN.
The difference in my screenshot is not because I replaced 1 by ORIGIN in the sum but rather because I omitted the norm(absolute value) you had around the second factor and replaced them by a pair of normal parentheses.
I just noticed that there is no absolute value or norm in the picture to the right of your calculation so I thought I'd mention that.
I can't comment on the correctness of the values, though.
Hmmm I understand your point . without the absolute to prevent the function from having negative values otherwise mistakes can occur
I modified the calculations to use range variables and don't use a program.
Maybe that way its easier for you to follow the calculations step by step and find the problem.
Basically you use these vectors:
and make this calculation (basically a recursion)
So you can compare the effect of the norm/absolute side by side.
Some things I noticed (and I am not sure if they have any meaning or are intended anyway):
Yes exactly this is why I used stack function for M
Thank you for pointing that out
I will try both and see
