Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
Is there any way to index functions so that I can call different functions through an indexed variable (i)? Something like this - although this only works as shown. When I try to turn x into a function (e.g. x as a function of t)) Mathcad balks and won't even let me define it (doesn't understand the syntax or refuses to let me define :=)
4.0 attached. Thanks!
Solved! Go to Solution.
Thanks Luc,
Does exactly what I asked for - so A+ for that. My actual sheet requires a bit of modification along these lines - really just having to do with how I want my functions arranged.
I guess I'll find out, but when I call x(t)_0 is it going to solve R1 and R2? That would really bog it down on a big sheet.
I also toyed with concat to create a function name like "x1", "x2" that I could call, but once something is a string I can't seem to do anything with it. But that would be slick if it worked.
Thanks,
Something like this?
Success!
Luc
Thanks Luc,
Does exactly what I asked for - so A+ for that. My actual sheet requires a bit of modification along these lines - really just having to do with how I want my functions arranged.
I guess I'll find out, but when I call x(t)_0 is it going to solve R1 and R2? That would really bog it down on a big sheet.
I also toyed with concat to create a function name like "x1", "x2" that I could call, but once something is a string I can't seem to do anything with it. But that would be slick if it worked.
Thanks,
Ok, Luc's idea worked. (Success!) It solved almost instantly so I think it was solving only what it needed to. Anyway, here's a final formulation (piecewise cam profile with 20 unique regions. The RegionX calculations house the equations for R, V, A, J, S for that region). Yet another handy trick to know.
@DJF wrote:
It solved almost instantly so I think it was solving only what it needed to.
No, it evaluates all 21 functions and only then selects the one result you demand by the index.