## Solving a system of differential equations issue

## Solving a system of differential equations issue

(OP)

I'm trying to solve a system of 2nd order ODEs that have a similar form to the following situation. Two masses are connected by a spring with spring constant f. m1 is the connected to a spring with spring constant h that is connected to a wall. I'm trying to numerically solve for position as a function of time for these two masses m0 and m1.

Here is the link to the sheet demonstrating the issue:

http://files.engineering.com/getfile.aspx?folder=8...

Thank you very much anyone that can help me with this. I'm rather new to MathCad and have been banging my head against the wall over this issue for a little while now.

Here is the link to the sheet demonstrating the issue:

http://files.engineering.com/getfile.aspx?folder=8...

Thank you very much anyone that can help me with this. I'm rather new to MathCad and have been banging my head against the wall over this issue for a little while now.

## RE: Solving a system of differential equations issue

http://files.engineering.com/getfile.aspx?folder=c...

TTFN

FAQ731-376: Eng-Tips.com Forum Policies

Need help writing a question or understanding a reply? forum1529: Translation Assistance for Engineers

## RE: Solving a system of differential equations issue

## RE: Solving a system of differential equations issue

TTFN

FAQ731-376: Eng-Tips.com Forum Policies

Need help writing a question or understanding a reply? forum1529: Translation Assistance for Engineers

## RE: Solving a system of differential equations issue

## RE: Solving a system of differential equations issue

The second problem is in the way the derivative works. Since you defined a function that contains a derivative, you cannot pass a vector to the function and expect it to work correctly, since it would attempt to do the derivative against a vector. You must pass individual values to the function. Therefore, for those graphs that involve the functions with derivatives, you can have xx[i in place of x for both the function and x-axis. I think it would also work using Mathcad's vectorization operator, but this way seems to work OK.

http://files.engineering.com/getfile.aspx?folder=8...

TTFN

FAQ731-376: Eng-Tips.com Forum Policies

Need help writing a question or understanding a reply? forum1529: Translation Assistance for Engineers

## RE: Solving a system of differential equations issue

I used state space instead of differential equations though

http://deltamotion.com/peter/Mathcad/Mathcad%20-%2...

here is an example of using rkfixed to solve the problem but there are two masses connected by one spring.

http://deltamotion.com/peter/Mathcad/Mathcad%20-%2...

Between the two you should get a good idea of what you need to do.

Peter Nachtwey

Delta Computer Systems

http://www.deltamotion.com

## RE: Solving a system of differential equations issue

## RE: Solving a system of differential equations issue

Peter Nachtwey

Delta Computer Systems

http://www.deltamotion.com

## RE: Solving a system of differential equations issue

## RE: Solving a system of differential equations issue

Peter Nachtwey

Delta Computer Systems

http://www.deltamotion.com

## RE: Solving a system of differential equations issue

## RE: Solving a system of differential equations issue

Do you know you can use if statements in the system of differential equations? You could try checking the value of the sign() function and then using one of the 3 different formulas depending on the value of sign(). That means you have 3 different versions of the formula in the 3rd row.

Peter Nachtwey

Delta Computer Systems

http://www.deltamotion.com

## RE: Solving a system of differential equations issue