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

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

Programming Mathcad prime- time steps, numerical evaluation

lvanlieren
1-Visitor

Programming Mathcad prime- time steps, numerical evaluation

Hey guys,

I'm Laura and im currently working on a worksheet in mathcad Prime 3. The first time programming and having a hard time trying to compute a rather simple loop for an explicit time-stepping (numerical evaluation) problem. For those who are familiar, it's the book of Chopra-Dynamics of structures ->chapter 5, p. 207,  Central Difference Method

Central difference-time steps.png

If someone could help me out, tips making the program work, that would be greatly appreciated!

Laura

ACCEPTED SOLUTION

Accepted Solutions
-MFra-
21-Topaz II
(To:lvanlieren)

Hi Laura, now it seems that everything is fine.

Greetings

FM

forLaura 2.jpg

View solution in original post

11 REPLIES 11
Werner_E
25-Diamond I
(To:lvanlieren)

Your file is in Prime 3.1 format which I (as may others here who also did not bother upgrading) unfortunately can't read. PTC provides no way to convert so all you could do is to additionally provide a screenshot or a pdf-Print of your file.

Regards

WE

Werner,

PDF copy of this Prime worksheet can be found in attachment.

I'd like to thank you VladimirN for uploading the pdf. Much appreciated.

Hi Laura,

there are a couple of issues with the worksheet,

The first, in the program is that you try to reference u[-1; the origin is either 0 or 1 - so this variable does not exist.

Too fix this I have added 1 to all the references - it seems to work but will need to be checked & tidied up

Capture.PNG

The second issue is with the plot.

the index variable needs to be written as a subscript & the function needs all the parameters.

Attached is Prime 2 version.

Hope this helps

Andy

LucMeekes
23-Emerald III
(To:AndyWesterman)

"the origin is either 0 or 1". No, it is whatever you define it, by default it's 0, but if you like you can set it to -1. See:

Luc

Thanks for the comments. It made the program run smoothly. However, I don't obtain the correct results. The response looks like an exponential function that goes to positive infinite, which is not true.

-MFra-
21-Topaz II
(To:lvanlieren)

Hello Laura, since there are enough other files offered by the community, I'll show only a photo of your problem solved by me, from which you can take whatever you need.

Cheers

FM

forLaura.jpg

Dear FM,

It is very kind of you responding that fast. Thanks a lot. However, unfortunately, when I compare the results of the example presented in the book of Chopra and those that are derived from the program I don't get the same answers. I highlighted the differences in green. I hope you are willing to take a look at it.

Book vs. mathcad.jpg

Hi Laura,

I haven't managed to reproduce the results here (yet), but I think that you need to compare the program against the book you are following.

So far I have noted that:

the x (p) input appears to have an additional 0 at the start.

c is defined as 0 in the program but 0.1592 in the book example.

the definition for a in the program is

Capture.PNG

but the book says

Capture.PNG

None of the above significantly affect the calculation, but it does suggest that  there are further corrections to be made.

regards

Andy

Hi Andy,

Thanks for taking a look at my problem. I summed my thoughts on your comments below.

1. The additional zero at the start is done to avoid an error. See the picture.

2. C is defined between the brackets. It doesn't affect the program since it is kept variable.

3. 'a' was incorrect. It's a typo, my bad.

error.jpg

I took a screen shot of the worksheet.

werror.jpg

Laura

-MFra-
21-Topaz II
(To:lvanlieren)

Hi Laura, now it seems that everything is fine.

Greetings

FM

forLaura 2.jpg

Announcements

Top Tags