summaryrefslogtreecommitdiff
path: root/modules/xcos/examples/solvers/Rootfinding.sce
blob: b995bb2592000ff82409f97d2edc33a563fdd835 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) 2012 - Scilab Enterprises - Paul Bignier
//
// This file is released under the 3-clause BSD license. See COPYING-BSD.

// Import the "with-ZC" diagram and augment the ending time
loadScicos();
loadXcosLibs();
importXcosDiagram("SCI/modules/xcos/examples/solvers/with_ZeroCrossing.zcos");
scs_m.props.tf = 30000;

// Set tolerances and select LSodar
scs_m.props.tol(1) = 1d-13;
scs_m.props.tol(2) = 1d-13;
scs_m.props.tol(6) = 0;

// Start the timer, launch the simulation and display time
tic();
try scicos_simulate(scs_m, "nw"); catch disp(lasterror()); end
t = toc();
disp(t, "Time with rootfinding:");

// Import the "without-ZC" diagram and augment the ending time
importXcosDiagram("SCI/modules/xcos/examples/solvers/without_ZeroCrossing.zcos");
scs_m.props.tf = 30000;

// Set tolerances and select LSodar
scs_m.props.tol(1) = 1d-13;
scs_m.props.tol(2) = 1d-13;
scs_m.props.tol(6) = 0;

// Start the timer, launch the simulation and display time
tic();
try scicos_simulate(scs_m, "nw"); catch disp(lasterror()); end
t = toc();
disp(t, "Time without rootfinding:");