Get Help

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- Plotting failed. Replace complex values and NaNs b...

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

04-06-2020
10:25 AM

04-06-2020
10:25 AM

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

Solved! Go to Solution.

Labels:

1 ACCEPTED SOLUTION

Accepted Solutions

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

04-06-2020
10:56 AM

04-06-2020
10:56 AM

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

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:

5 REPLIES 5

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

04-06-2020
10:41 AM

04-06-2020
10:41 AM

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

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

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

04-06-2020
10:56 AM

04-06-2020
10:56 AM

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

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)?

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

04-06-2020
10:59 AM

04-06-2020
10:59 AM

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

> The two functions x1'(t) and z1'(t) are not defined

No, its the derivative operator which should be fully functional in Prime (in real Mathcad we could only use it in a solve block with odesolve).

As written in my answer to the OP I consider it a bug of Prime as it looks like its the combination of vector argument and derivative operator which causes that error.

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

04-06-2020
10:56 AM

04-06-2020
10:56 AM

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

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:

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

04-06-2020
02:43 PM

04-06-2020
02:43 PM

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

ok, thank you Werner!