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

Translate the entire conversation x

I have two problems defining the spectrum

pannus0
10-Marble

I have two problems defining the spectrum

I have two problems defining the spectrum:
1. Acceleration spectrum
2. Displacement spectrum
I tried to replicate it in Mathcad 11 without success. I followed an example created in Mathcad 13, which includes the Boolean function formulations, but the program detected errors because some variables are not defined, preventing me from graphing them.

Please clarify what I'm doing wrong.

pannus0_0-1762273406816.pngpannus0_1-1762273448264.png

pannus0_2-1762273499331.png

pannus0_3-1762273537287.png

 

pannus0_4-1762273556719.png

 

ACCEPTED SOLUTION

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

I guess second hypothesis means you second try to duplicate the function Sa from the MC13 screenshot.

 

Your first try was the best anyway. Because you used units (a good idea as this is one of the strengths of Mathcad and also Prime) you have to use 2.4 s instead of just 2.4 as Luc already stated.

And you can/should plot the function Sa(t) and not define another one where all the used variables are unknown. Variables you define inside a program (like RW and C) ar known only local inside the program but not at worksheet level.

Werner_E_0-1762287169668.png

More mistakes in the definition of Sd. You have to define/assign RW and C in the same way as in your function Sa using local assignments. Just writing the variable name below the comparisons can't work. Once you do that and add the unit for the value 2.4 you are again up and running.

You don't need to use RW and C as arguments of your function. After all you don't intend to provide values when you call the function, don't you? You simply provide a time value, nothing more.

I changed the name of the used time argument from uppercase T as you did to lowercase t, but this would in no way have been necessary. The name of the formal function argument does not matter at all. The range T you define is and should be only used for the plots.

Werner_E_1-1762287467057.png

Prime 11 sheet attached

 

 

View solution in original post

10 REPLIES 10
LucMeekes
23-Emerald IV
(To:pannus0)

It's good that you state which version of Prime you use.

But you should (whenever possible) ALWAYS attach the worksheet.

Have you tried using the converter (built into Prime 11) to convert the sheet from Mathcad 13 to Prime 11?

 

The variable R.W is unknown in all those places because it only exists within the program(s).

So you cannot use it to evaluate expressions on sheet level.

 

Success!
Luc

 

 

 

 
That's strange, I could swear I attached the file in version 11
LucMeekes
23-Emerald IV
(To:pannus0)

Check your units.

In the first S.a program you are comparing the parameter t with 2.4, so t should be unitless. But in the next if-statement you are comparing 2.5*Tp/t with 2.5, so t must have the same unit as Tp (who has s as a unit.)

 

Correct these errors and try to evaluate S.a(1*s)

 

As said, the variable R.W is unknown at sheet level, so your definition of S.a_E.030(t) must fail. Also C is unknown at sheet level.

 

Success!
Luc

pannus0
10-Marble
(To:pannus0)

 

I don't know why the Mathcad version 11 file wasn't attached, but I'm attaching it now.

Werner_E
25-Diamond I
(To:pannus0)

Why don't you attach the Mathcad 13 worksheet (which obviously is legacy Mathcad) and your attempt in Prime 11.

All can say from the pictures is that Rw is never assigned a value so you can't use it in numerical calculations.

Rw is only locally assigned a value in the first function Sa(t) but you don't use this function for evaluating a value.

I'm not attaching version 13 because it's just a screenshot of a PDF file.

Werner_E
25-Diamond I
(To:pannus0)

I guess second hypothesis means you second try to duplicate the function Sa from the MC13 screenshot.

 

Your first try was the best anyway. Because you used units (a good idea as this is one of the strengths of Mathcad and also Prime) you have to use 2.4 s instead of just 2.4 as Luc already stated.

And you can/should plot the function Sa(t) and not define another one where all the used variables are unknown. Variables you define inside a program (like RW and C) ar known only local inside the program but not at worksheet level.

Werner_E_0-1762287169668.png

More mistakes in the definition of Sd. You have to define/assign RW and C in the same way as in your function Sa using local assignments. Just writing the variable name below the comparisons can't work. Once you do that and add the unit for the value 2.4 you are again up and running.

You don't need to use RW and C as arguments of your function. After all you don't intend to provide values when you call the function, don't you? You simply provide a time value, nothing more.

I changed the name of the used time argument from uppercase T as you did to lowercase t, but this would in no way have been necessary. The name of the formal function argument does not matter at all. The range T you define is and should be only used for the plots.

Werner_E_1-1762287467057.png

Prime 11 sheet attached

 

 

Dear Werner E, your analysis is excellent. However, I'd like to ask how I obtain the sa and sd values?

Regards

Werner_E
25-Diamond I
(To:pannus0)


@pannus0 wrote:

Dear Werner E, your analysis is excellent. However, I'd like to ask how I obtain the sa and sd values?

Regards


Not sure if I understand what you mean. To get the values you simply use sa and sd as fuctions. By this I mean you provide an argument (time value) and get the desired value:

Werner_E_0-1762295177566.png     Werner_E_1-1762295212061.png

In case you need a table of multiple values I would suggest that you create a vector of time values (not using the range T as a range is quite different from a vector).

Prime 11 offers a nice new function "vec" to quickly create a vector.

Werner_E_3-1762295408771.png

It is necessary to vectorize (the arrow over the expression, see the "operators" menu) the function call.

 

Ahh, and what you see in the picture above will not work for you because of a division by zero when the argument is 0s.

i changed the condition for the calculation of C in both programs and also the last expression in S.d to make it work OK for 0s as well:

Werner_E_4-1762295579651.png

 

 

Thank you very much!

Announcements

Top Tags