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

Community Tip - You can change your system assigned username to something more personal in your community settings. X

Old script mathcad needed help to convert to Mathcad Prime v3.1 research purpose

Jeremy
8-Gravel

Old script mathcad needed help to convert to Mathcad Prime v3.1 research purpose

Hi,

I  recently obtained a research script based on mathcad (old version) by my colleague and i tried to follow the sequence using Mathcad Prime v3.1. But it shows error after copying the whole sequence on Prime. 

The aim is to produce several acceleration graph as seen in the file images.

The script image named after capture 1 to 4.

The error image i encountered was in Error 1.

Really appreciate if someone can rewrite it in Mathcad Prime version would be helpful for my research in earthquake seismic design.

 

Thank you.

 

 

ACCEPTED SOLUTION

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

There are two errors:

1) you have typed square brackets [ ] but you should only use normal parentheses ( ). Mathcad 15 and below will occasionally show nested parenthesis as mixed, square and round. But thats for display (and is not done in Prime). Always type ( ) in arithmetic expressions. Using [ ] in Prime means you are creating a matrix/vector.

You have used square brackets two times,

B1.png

 

2) You got the structure for the assignment of a value to u_prev and u[i+1 completely wrong. This part of the routine is at the end of your capture1 and beginning of capture2 and should look like this:

B0.png

This is what that part of the routine should look like in Prime

B2.png

As an alternative you could also do it that way:

B3.png

 

I have not attached the corrected sheet because I am using Prime 4 and ridiculously Prime cannot save in older formats and you would not be able to use a P4 file with your P31.

Hope its clear what you will have to do.

View solution in original post

13 REPLIES 13

Hi,

 

Upload the original mathcad file if you have it to help the person who gets it working for you.  You can convert the sheet

 

experience problems when attaching a Mathcad sheet file ( .mcd, .xmcd or .mcdx) to the message then zip it first. To get the .zip file, use Windows Explorer, select the sheet file, right-mouse click and select "Send to" then "Compressed (zipped) folder". This results in a .zip file containing the worksheet that you can attach.

 

Cheers

Terry.

Werner_E
25-Diamond I
(To:Jeremy)

If you don't have access to the old Mathcad sheet because you only have the prints at least attach your attempt doing it in Prime (zip the file before attaching it).

You show the position of the error but not what the error message is. It may be a problem with Primes infamous auto labeling or you may have mixed up literal with matrix indices.

Hi,

 

Thank you for the comment and advice.

 

Attached is the zip file for prime as requested.

Werner_E
25-Diamond I
(To:Jeremy)

OK, as far as I see all your problems come from using literal indices where you should have used matrix indices.

A literal index is what you get when you press Ctrl and - or chose "subscript" from the menu. What you then type as subscript is simply part of the variable name.

What is needed in your sheet are matrix/vector subscripts as they determine which element of a vector is meant.

You get a matrix index by typing [ or you can chose it from the operators menu in the first ribbon.

 

The optical difference is not that big - vector indices are a bit lower in Prime and if you click in the region you see a small square (left: literal, right: vector):

B.png

Thank you and appreciate for the fast respond.

 

Will try and see if i am able to execute the script.

 

-Jeremy

Hi

 

I manage to change all the literal indices to matrix index. It shows positive sign but at the end when i tried to compute a function, there is a error. 

 

Attach is prime script 

 

Werner_E
25-Diamond I
(To:Jeremy)

There are two errors:

1) you have typed square brackets [ ] but you should only use normal parentheses ( ). Mathcad 15 and below will occasionally show nested parenthesis as mixed, square and round. But thats for display (and is not done in Prime). Always type ( ) in arithmetic expressions. Using [ ] in Prime means you are creating a matrix/vector.

You have used square brackets two times,

B1.png

 

2) You got the structure for the assignment of a value to u_prev and u[i+1 completely wrong. This part of the routine is at the end of your capture1 and beginning of capture2 and should look like this:

B0.png

This is what that part of the routine should look like in Prime

B2.png

As an alternative you could also do it that way:

B3.png

 

I have not attached the corrected sheet because I am using Prime 4 and ridiculously Prime cannot save in older formats and you would not be able to use a P4 file with your P31.

Hope its clear what you will have to do.

Hi Werner,

 

I encounter another error when trying to input another loading function as shown in image below.

 

Attach is the mathcad prime script.

 

Thank for your help.x1.JPG

 

-Jeremy

Werner_E
25-Diamond I
(To:Jeremy)

Again a problem with the square brackets - parameter parenthesis also must be "round".

What you had created was "floor times a vector".

B1.png

 

BTW, you don't need to apply the vector indices in the plots - you could also simply plot one vector over the other.

B2.png

 

You can move the axis labels to different positions and on each axis you can change the first, second and last value (its a bit tricky as the numbers are far too tiny and can't be scaled).

Hi Werner,

 

Sorry for keep asking question on the script as i am not used to mathcad, my sincerely apologize.

 

I have question regarding how to change the graph under time step settings in irregular loading function ? because i am getting a straight line on both axis.

 

For the last part, the script required to create a path where a person can insert folder name, file, and path where the file is in .txt as attached in the rar (one of the earthquake acceleration occur in elcentro). I tried to execute the script and failed as the iaccel:= (non responding answer where there is a yellow circle keep moving as seen in the image

Attach is the prime script.

 

Thankyou

 

-JeremyB3.JPG

B2.JPGB1.JPG

Werner_E
25-Diamond I
(To:Jeremy)


I have question regarding how to change the graph under time step settings in irregular loading function ? because i am getting a straight line on both axis.

Look at the max value on the abscissa! Its 1000 because the last value in your vector tvec for some reason is 999 (not sure why). You can set that end value to any value. In the former file I had chosen 3 as in the original script.

B1.png

 


For the last part, the script required to create a path where a person can insert folder name, file, and path where the file is in .txt as attached in the rar (one of the earthquake acceleration occur in elcentro). I tried to execute the script and failed as the iaccel:= (non responding answer where there is a yellow circle keep moving as seen in the image

It looks like the read-in in the data was done successfully. You have a typo in the folder name (C.\ instead of C:\" and you don't use the folder name when creating the full path to the data file. Not sure if this was done on purpose by you. For testing I changed the path to access the data file in the current dir.

One error was that you misinterpreted the end value of the range iaccell as being last(u''gg)*last(u''gg) while in fact its just last(u''gg). The other last(u''gg) is already another region and is simply evaluated there to see how many data points were in the file.

The second error was the use of a literal subscript which in fact should have been a vector subscript (three times, see picture).

You may notice that in my plot I have moved the abscissa axis down for better clarity and added a dummy zero-line (abscissa). Again you will have to set the first and last value on each axis manually to have better control over the outcome and also set the second value on each axis as Primes autoscaling usually is rather useless (seems to simply divide into 10 sections, whatever step that may mean).

B2.png

 

Fred_Kohlhepp
23-Emerald I
(To:Jeremy)

Looking at error 1.jpg  (I agree, whatever sheet you have would be better than pictures.)  your first error (the red boxes) is on I, where I goes from 1 to nstep.  But I see that you've define ORIGIN as 0 in error 1(2).jpg.  So there's one problem.

 

But why the box around i ?    I wrote it out:

Capture.PNG

No box!  Until I changed a label:

Capture1.PNG

Prime uses labels to differentiate between variables, constants, etc.  If i has two different labels, they are two different things.  Zip and send the file!

Hi,

 

Thank you for the comment and advice.

 

Attached is the zip file for prime as requested.

 

 

 

 

 

 

Announcements

Top Tags