Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X
I was looking at the sample worksheet (PDF) posted on the PTC website and I created a (supposed to be) matching MathCAD Prime 7.0 worksheet.
Almost everything matches the sample PDF results...the Shear values, shear graph, and maximum Moment.
BUT the moment function and graph points are way off.
I've skimmed over everything multiple times and I can't see any typos or errors.
Can anyone see where the error is? Thanks!
Solved! Go to Solution.
Again vectorization does the job
And again my question - why bother with the vectors when you simply want a plot of a function to be done? (Thats what Excel people have to do but its not necessary to do so in Mathcad or Prime).
You may also use Primes Quickplot feature which means that you don't have to define the variable (xm) for the abscissa at all (neither as a vector, nor as a range). You have to edit the axis ticks (first, second and last) to get the plot done for the desired range from 0 to 27. Prime will automatically use appropriate values for xxm even though its not defined. But Prime will only use simple scalars. So if you need unit, you will have to multiply xxm by the desired unit and that doesn't look really good.
I find that its easier and gives better control to define a range variable like xm to be used in the plot.
Again vectorization does the job
And again my question - why bother with the vectors when you simply want a plot of a function to be done? (Thats what Excel people have to do but its not necessary to do so in Mathcad or Prime).
You may also use Primes Quickplot feature which means that you don't have to define the variable (xm) for the abscissa at all (neither as a vector, nor as a range). You have to edit the axis ticks (first, second and last) to get the plot done for the desired range from 0 to 27. Prime will automatically use appropriate values for xxm even though its not defined. But Prime will only use simple scalars. So if you need unit, you will have to multiply xxm by the desired unit and that doesn't look really good.
I find that its easier and gives better control to define a range variable like xm to be used in the plot.
I tried putting the Shear and Moment calculations into standalone functions.
Similarly to what I was running into before, the shear calculation is correct (once someone pointed out my stupid mistakes), but the moment calculation is "incorrect" similar to
I tried vectorizing the result and a few other locations. It either had no effect or it returned an error message that "the vectors must be the same size".
Can anyone see where the error is? Thanks!
The error occurs because a and w are 3-element vectors, while p is a 2-elememnt vector. For vectorisation, all vectors need to be the same size (length). The other parameters to the function are scalars, that's OK.
Success!
Luc
Why would you like to call this function vectorized? The function obviously is written to expect a, w and p to be vectors.
Even if p would be a vector of three element, I guess you won't get the result you expect.
Vectorization means that the elements of the vectors (ALL vectors, thats the reason the have to be of same length) are singly fed into the function. That means that L <- sum a would throw an error because is then would not be a vector, etc.
If your goal is to feed a vector for the first argument x and only vectorize for this vector, you would have to resort to a trick like the one shown below:
The redefined function BAM uses a local auxiliary function with just the first argument as its argument which calls your original BAM function and then calls this function vectorized. You may consider renaming your original function to avoid confusion.
The first argument (x) of the function BAM( ) now can be either a scalar or a vector of values.