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

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

Centroid of multiple distributed loads

dsochor
10-Marble

Centroid of multiple distributed loads

In the attached Mathcad Prime 3.1 single page worksheet (with pdf print) I am attempting to find the centroid of multiple distributed loads on a beam. The equations work for a single distributed load but I am attempting to make them work for as many distributed loads as the user would like to enter into the worksheet. The Azz vector is changed so that there is not division by zero. The error on f(x) is that it must be an integer. I have attempted to use the vectorize to get around this. Is there another way to make this work?

5 REPLIES 5
RichardJ
19-Tanzanite
(To:dsochor)

Don't create vectors at the start, and then propagate them through the entire worksheet. Make f a function of x, we, ws, ze, and zs, f(x,we,ws,ze,zs). Do the same for A. Then create a function of x, we, ws, ze, and zs for your integral. Finally, create the vectors for we, ws, ze, and zs, and pass them to the function (probably with the vectorize operator).

Note that you create ws, we, zs, an d ze using indices of 1 and 2. That gives you a three element vector with the first element equal to zero. That's because the default origin for arrays in Mathcad is 0, not 1. Either use indices of 0 and 1, or type ORIGIN:1 at the top of the worksheet, and change zz to go from 1 to z+1

Thank you Richard, I'll create these multiple variable functions for f, A, and the integral. Is it good practice to define all functions before vectors are defined?

The reason I set the origin at zero to give the option to set the distributed load as zero when there isn't a distributed load (other loads are applied to the beam).

RichardJ
19-Tanzanite
(To:dsochor)

If you want to calculate a result for multiple input variables it's good practice to write the problem out as a series of dependent functions of the variables you wish to change, and then call the end function for each value of the variable(s). You could pass the end function a vector (or vectors), or you could use a range variable to iterate through the desired input values, or you could put the function in a program and loop through the values that way.

Thanks Richard. I choose your first recommended approach: call the end function for each value of the variable(s). Is there a way to get around functions that divide by zero?

RichardJ
19-Tanzanite
(To:dsochor)

It's your definitions of we, ws, etc. They should be we[0, we[1, ws[0, ws[1, etc. Then I think it will work.

Announcements

Top Tags