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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Function to Calculate x-distance between series of consecutive points on a circle

CP_10630888
2-Explorer

Function to Calculate x-distance between series of consecutive points on a circle

I am developing a template which calculates the y distance between points spaced evenly on a circle. Think bar reinforcement in a circular column. The user will input the diameter of the column, d, and number of bars, N_bars, spaced evenly. I'm able to define the delta_y between points, but I'm struggling to write a program that outputs the data I want in a single array. I've attached my file for reference. I can't get a 'for' loop to work, but maybe there's a more efficient/logical way. Thank you all for the help!

 

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:Werner_E)

In case you had in mind that the first bar should always be at (0/R), here is the appropriate function.
Guess the 3.248 were a typo and should read 3.245?

Werner_E_2-1684265367685.png

 

 

View solution in original post

8 REPLIES 8

Hi,

your MartinHanak_0-1684258573298.png in MartinHanak_1-1684258600465.png is x with subscript i.

Replace the subscript with index.

MartinHanak_2-1684258844092.png

 

Result follows

MartinHanak_3-1684258887797.png

 


Martin Hanák

Thank you for spotting that definition error. I'm still learning Mathcad and didn't see that in the example material I'm using online. This resolves the definition error, but I need to revise the x_i definition to return the values I need. Per my response to Werner_E,

     

for N=8, I expect the vector to return [ 1.538 , 3.712 , 3.712 , 1.538 ]

 

for N=10 → [  1.003 , 2.625 , 3.248 , 2.625 , 1.003 ] 

 

for N=12 → [ .703 , 1.922 , 2.625 , 2.625 , 1.922 , .703 ]

Werner_E
25-Diamond I
(To:CP_10630888)

As Martin already said you were using the wrong type of index (literal index instead of vector/matrix index) which caused your program to fail.

But I guess that the results is not what you expected. After all the Delta difference between the y-values of your bars is not equal as your program seems to assume.

Can you state exactly which vector you expect as a result for N=8 and which one for N=10 or N=6 ?

As N should be even, we have symmetry on x- and y-direction, so one quarter circle should be all that's needed?

That means that for N=8 you would only have two values, 3.7123 in and 1.5377 in. Is this correct?

For N=6 we would have just one value and for N=10 there again would be just two. ??

Or for all the above one additional value if you want to see the zero in he vector as well.

Would something like the function shown below be what you are looking for?

EDIT: File removed as it did not provide the desired solution
See my answer below

 

The result is also dependent on the user input diameter, d. For this example, let's assume 18 inches. N can never be less than 8. I agree that the values are mirrored across the axis, but if it's possible to define the limits of the program to evaluate a half circle then that would be ideal.

 

for N=8, I expect the vector to return [ 1.538 , 3.712 , 3.712 , 1.538 ]

 

for N=10 → [  1.003 , 2.625 , 3.248 , 2.625 , 1.003 ] 

 

for N=12 → [ .703 , 1.922 , 2.625 , 2.625 , 1.922 , .703 ]

 

 

Werner_E
25-Diamond I
(To:CP_10630888)

The diameter d is already used for the calculation of R, the radius if the circle the center of the bars are lying on, isn't it?

 

My function was faulty, now I get the desired values for 8 and 12, but where do the values for N=10 stem from?

Can you provide a sketch.

My function calculates the lengths shown in the pic below, according to what you showed in your Autocad drawing. Of course I assumed that the first bar would always be on the x-axis at (R / 0).

Werner_E_0-1684264123498.png

 

CP_10630888_0-1684264552943.png

Your function is calculating correctly. Rotate it 90 degrees so the single bar section is located at the top and you get what I calculated. 

Werner_E
25-Diamond I
(To:CP_10630888)

Thanks, in the meantime I already guessed what you had in mind and provided a solution. See below.

Werner_E
25-Diamond I
(To:Werner_E)

In case you had in mind that the first bar should always be at (0/R), here is the appropriate function.
Guess the 3.248 were a typo and should read 3.245?

Werner_E_2-1684265367685.png

 

 

Announcements

Top Tags