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
- :
- IF in Given-Odesolve

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

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

10-26-2019
07:43 AM

10-26-2019
07:43 AM

IF in Given-Odesolve

Can we use IF in the Given-Odesolve Block?

See please the red operator in attach!

Labels:

21 REPLIES 21

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

10-26-2019
10:11 AM

10-26-2019
10:11 AM

Re: IF in Given-Odesolve

Try the step function (PHI)...

Success!

Luc

Success!

Luc

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

10-26-2019
05:45 PM

10-26-2019
05:45 PM

Re: IF in Given-Odesolve

Can't see your sheet, but here:

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

10-26-2019
08:18 PM

10-26-2019
08:18 PM

Re: IF in Given-Odesolve

@ValeryOchkov wrote:

Can we use IF in the Given-Odesolve Block?

Yes, we can! 🙂

The problem is not the if-function you used.

The error message says something about an unstable problem resulting in a step size too small and suggests that you reduce the integration interval.

If you follow this suggestion and set t.end to 0.5 the solve block perfectly works.

Looks like the solution curve has a tendency you shoot up vertically at the new end value which makes the solve block fail if t.end is larger:

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

10-26-2019
11:33 PM

10-26-2019
11:33 PM

Re: IF in Given-Odesolve

Thanks, I see

I use not if in attach.

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

10-27-2019
04:57 AM

10-27-2019
04:57 AM

Re: IF in Given-Odesolve

@ValeryOchkov wrote:

Thanks, I see

I use not if in attach.

Yes, but thats not equivalent, thats a completely different function .

As already written above, the if function is NOT the problem.

E.g. you may use

with success, but if you use lower values than 66.323N for "limit", the block gets too unstable and fails.

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

10-27-2019
05:25 AM

10-27-2019
05:25 AM

Re: IF in Given-Odesolve

Thanks, Werner!

But what about the logistic function in attach (Prime)

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

10-27-2019
05:50 AM

10-27-2019
05:50 AM

Re: IF in Given-Odesolve

@ValeryOchkov wrote:

Tanks, Werner!

But what about the logistic function in attach (Prime)

It seems to have the same problem (the error message in Prime is less specific).

Your question was, if the "if" function can be used in the odesolve-block and the answer clearly is a "Yes".

The error was not because of the if function but is due the setup and modelling of your problem in general as your new example with the logistic function shows.

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

10-27-2019
12:44 PM

10-27-2019
12:44 PM

Re: IF in Given-Odesolve

One solution in attach (Prime).

Questions:

- How calculate the potential energy of the link?
- Why we have an error on the board from the elastic to hard link?
- Can we use the logistic function?

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

10-27-2019
02:05 PM

10-27-2019
02:05 PM

Re: IF in Given-Odesolve

There is a unit mismatch when you add the signals:

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

10-27-2019
02:38 PM

10-27-2019
02:38 PM

Re: IF in Given-Odesolve

Yes! The formula is wrong! I need a correct one!

The sum of three kind of energy must be constant!- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

10-27-2019
02:54 PM

10-27-2019
02:54 PM

Re: IF in Given-Odesolve

Hi,

In my opinion the mistake is in the definition of the elastic constant: the units are N/m=kg/s^2.

Bye bye

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

10-27-2019
03:27 PM

10-27-2019
03:27 PM

Re: IF in Given-Odesolve

I agree that the additional factor x in the integral (pe2) was wrong and caused the unit mismatch.

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

10-27-2019
03:42 PM

10-27-2019
03:42 PM

Re: IF in Given-Odesolve

Hi,

In my opinion the mistake is in the definition of the elastic constant: the units are N/m=kg/s^2.

Bye bye

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

10-27-2019
03:51 PM

10-27-2019
03:51 PM

Re: IF in Given-Odesolve

Thanks!

But the sum of 3 types of energy must be constant!

See please the case with the linear Hook law

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

10-27-2019
03:53 PM

10-27-2019
03:53 PM

Re: IF in Given-Odesolve

Утро вечера мудренее! I go to bet!

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

10-27-2019
03:58 PM

10-27-2019
03:58 PM

Re: IF in Given-Odesolve

You have to redo everything

Спокойной ночи

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

10-27-2019
04:03 PM

10-27-2019
04:03 PM

Re: IF in Given-Odesolve

я надеюсь, что мне ночью приснится решение этой красивой задачи, как Менделееву приснилась таблица химических элементов

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

10-27-2019
04:18 PM

10-27-2019
04:18 PM

Re: IF in Given-Odesolve

__They say that the periodic table was first dreamed of by Pushkin, but he did not understand anything in it!__

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

10-28-2019
02:23 AM

10-28-2019
02:23 AM

Re: IF in Given-Odesolve

I saw at night in a dream that there we can have in the solve block not four, but three functions!

But I did not see the correct formula for calculating the potential energy of an elastic link with the non-linear Hooke law 😞

And still no one told me in a dream why we cannot work in the not elastic region of Hooke's nonlinear law.

😞

😞

😞

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

10-28-2019
02:42 AM

10-28-2019
02:42 AM

Re: IF in Given-Odesolve

This apple needs to fall on one of us on the head!

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

10-28-2019
05:29 AM

10-28-2019
05:29 AM

Re: IF in Given-Odesolve

Доброе утро!

In general, we try to understand something when something is wrong. You could "waste" a few words, to say that in the worksheet you use "spring compliance" and not "spring stiffness".