laureapresa
laureapresa

Reputation: 179

Modify one odeset parameter

I am using ode15s to solve a DAE problem. I give through odeset the Mass Matrix and some more info:

opts=odeset('Mass',M,'MassSingular','yes','MStateDependence','none');

I calculate also Jpattern from a previous run. To feed it to the function, I could write once again

opts=odeset('Mass',M,'MassSingular','yes','MStateDependence','none', 'JPattern',JPat);

Is there a way to modify that single parameter and keep the rest of the structure?

I tried

opts.JPattern = JPat;

But it is not working.

Upvotes: 0

Views: 114

Answers (1)

am304
am304

Reputation: 13876

You can probably do something like:

opts = odeset('Mass',M,'MassSingular','yes','MStateDependence','none');
opts = odeset(opts,'JPattern',JPat);

This is using the syntax (see the documentation):

options = odeset(oldopts,'name1',value1,...) alters an existing options structure oldopts. This sets options equal to the existing structure oldopts, overwrites any values in oldopts that are respecified using name/value pairs, and adds any new pairs to the structure. The modified structure is returned as an output argument.

Upvotes: 2

Related Questions