octave:2> persona.nome='Marco' persona = scalar structure containing the fields: nome = Marco octave:3> persona.cognome='Caliari' persona = scalar structure containing the fields: nome = Marco cognome = Caliari octave:4> persona.anni=20 persona = scalar structure containing the fields: nome = Marco cognome = Caliari anni = 20 octave:5> persona.anni+2 ans = 22 octave:6> persona.matrice=rand(2,2) persona = scalar structure containing the fields: nome = Marco cognome = Caliari anni = 20 matrice = 0.86161 0.79991 0.12030 0.23032 octave:7> isfield(persona,'nome') ans = 1 octave:8> isfield(persona,'Nome') ans = 0 octave:9> k=0.1 k = 0.10000 octave:10> 0+k ans = 0.10000 octave:11> ans+k ans = 0.20000 octave:12> ans+k ans = 0.30000 octave:13> ans+k ans = 0.40000 octave:14> ans+k ans = 0.50000 octave:15> ans+k ans = 0.60000 octave:16> ans+k ans = 0.70000 octave:17> ans+k ans = 0.80000 octave:18> ans+k ans = 0.90000 octave:19> ans+k ans = 1.00000 octave:20> 1==ans ans = 0 octave:21> odefun = @(t,y) y; octave:22> y0=1; octave:23> tspan=[0,1]; octave:24> options.InitialStep=0.25; octave:25> [tout,yout]=rk2(odefun,tspan,y0,options); octave:26> tout tout = 0.00000 0.25000 0.50000 0.75000 1.00000 octave:27> yout yout = 1.0000 1.2812 1.6416 2.1033 2.6949 octave:28> abs(exp(1)-yout(end)) ans = 0.023426 octave:29> options.InitialStep=0.25^2; octave:30> [tout,yout]=rk2(odefun,tspan,y0,options); octave:31> yout yout = 1.0000 1.0645 1.1331 1.2061 1.2838 1.3666 1.4547 1.5484 1.6482 1.7544 1.8675 1.9879 2.1160 2.2524 2.3976 2.5521 2.7166 octave:32> abs(exp(1)-yout(n)) error: `n' undefined near line 32 column 17 error: evaluating argument list element number 1 error: evaluating argument list element number 1 octave:32> abs(exp(1)-yout(end)) ans = 0.0016883 octave:33> 0.023426/0.0016883 ans = 13.875 octave:34> 1/k^2 ans = 100.00 octave:35> k k = 0.10000 octave:36> 1/0.25^2 ans = 16 octave:37> options.InitialStep=0.125; octave:38> [tout,yout]=rk2(odefun,tspan,y0,options); octave:39> abs(exp(1)-yout(end)) ans = 0.0064406 octave:40> options.InitialStep=0.125/2; octave:41> [tout,yout]=rk2(odefun,tspan,y0,options); octave:42> abs(exp(1)-yout(end)) ans = 0.0016883 octave:43> ans/0.0064406 ans = 0.26213 octave:44> 0.0064406/0.0016883 ans = 3.8148 octave:45> options.InitialStep=0.125/2; octave:46> [tout,yout]=rk2(odefun,tspan,y0,options); octave:47> abs(exp(1)-yout(end)) ans = 0.0016883 octave:48> options.InitialStep=0.125/4; octave:49> [tout,yout]=rk2(odefun,tspan,y0,options); octave:50> abs(exp(1)-yout(end)) ans = 4.3215e-04 octave:51> 0.0016883/ans ans = 3.9067 octave:52> odefun=@(t,y) t; octave:53> options.InitialStep=0.125/2; octave:54> [tout,yout]=rk2(odefun,tspan,y0,options); octave:55> abs(1/2-yout(end)) ans = 1 octave:56> y0=0 y0 = 0 octave:57> [tout,yout]=rk2(odefun,tspan,y0,options); octave:58> abs(1/2-yout(end)) ans = 0 octave:59> odefun = @(t,y) y; octave:60> options.InitialStep=0.3; octave:61> [tout,yout]=rk2(odefun,tspan,1,options); octave:62> tout tout = 0.00000 0.30000 0.60000 0.90000 1.00000 octave:63> diary off