Turn on suggestions

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

Showing results for

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

Showing results for

** Community Tip** - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more!
X

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

Nov 02, 2020
05:46 PM

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

Nov 02, 2020
05:46 PM

Odesolve solve block Variable still showing Undefined

Am I missing something in the solve block? I tried not to extend the equations too much, for instance, Instead of typing out the full equation for h_tga, I define h_tga above then call for h_tga in equations 1,2 &3. Would I be better off typing all the variables **bleep** for tat?

Labels:

3 REPLIES 3

Nov 02, 2020
06:28 PM

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

Nov 02, 2020
06:28 PM

At first glace I see two problems:

1) You use function but omit the argument! That way its interpreted as variable! You have to write P.w(t), T.w(t), etc.

2) If you use that kind of "abbrevations" using auxiliary functions like P.w(t) which are dependent on the searched for functions like T.w(t), you must also let odesolve solve for these functions, too (and provide initial conditions).

So it may be better, not to use those aux functions.

A way to get around this problem and nonetheless use those aux functions could be this:

Define your functions above the solve block like this:

and use this function in the solveblock that way:

Nov 05, 2020
09:47 AM

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

Nov 05, 2020
09:47 AM

Using the workaround that you suggested, would I have it setup like the following then?

Nov 05, 2020
11:10 AM

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

Nov 05, 2020
11:10 AM

When you click on the region with the error and go to the calculation ribbon menu, you have the option here to trace the error. If you do so, you are sent to this region:

There are a couple of problems:

1) You forgot to write Tw(t) instead of just Tw a couple of times

2) You would also have to define h.cwg to be a function of t, not just a variable

3) You can't define h.cwg(t) using T.w(t), because T.w(t) is not yet defined (you are just looking for it).

You could use the boolean = instead of the assignment, but if you do so, you would also include h.cwg in the least of functions you would like to find with odesolve.

A better approach IMHO is this:

As with P.w and P.g you define in front of the solve block

and use it in the solve block like

This may apply to other functions as well.

NOTE: Everything you define with an assignment operator ":=" should be placed outside and in (if necessary) in front of the solve block. And if it depends on the functions you are just looking for, you have to do it similar to what I just showed with h.cwg.