Skip to main content
1-Visitor
April 6, 2020
Solved

Plotting failed. Replace complex values and NaNs by real numbers.

Hello,

 

I am new to MathCad. I plotted the freefall equation and solved for x and z. Then I would like to plot the velocity, so x' and z' but get the error: "replace with complex values and NaNs by real numbers". It shouldn't have complex values and NaNs, I have checked the odesolve syntax, the time step and the units, but still can't find the mistake.

Would appreciate help! The file is attached.

Thanks in advance!

 

Ln

Werner_E
Werner_EAnswer
25-Diamond I
April 6, 2020

You may consider using a simple range variable for t rather than the vector you used.

Werner_E_0-1586184582497.png

I am not quite sure why Prime has problems with the way you had set up the sheet - it should work OK. But Prime seems to have problems with the combination of the vector t and the derivative operator. We may call it a bug.

Another way around this problem/bug is to define the derivatives as separate functions and use these:

Werner_E_1-1586184932221.png

 

 

5 replies

23-Emerald IV
April 6, 2020

There's something weird going on in your sheet.

The two functions x1'(t) and z1'(t) are not defined which I think is what causes the error message for your plot.

But I would have expected an error message at the definition of v1(t), which uses those two undefined functions.

 

Luc

Translate
Ln31-VisitorAuthor
1-Visitor
April 6, 2020

Hey Luc,

 

I thought it is enough to define the u0 and v0, and when solving x and z, it should calculate x'(t) and z'(t). If I insert a single value for t, I also get a plausible answer.

Do you have an idea why I get these results as well as the plot v1(t)?

Translate
Werner_E
Werner_E25-Diamond IAnswer
25-Diamond I
April 6, 2020

You may consider using a simple range variable for t rather than the vector you used.

Werner_E_0-1586184582497.png

I am not quite sure why Prime has problems with the way you had set up the sheet - it should work OK. But Prime seems to have problems with the combination of the vector t and the derivative operator. We may call it a bug.

Another way around this problem/bug is to define the derivatives as separate functions and use these:

Werner_E_1-1586184932221.png

 

 

Translate
Ln31-VisitorAuthor
1-Visitor
April 6, 2020

ok, thank you Werner!

Translate