[Scilab-users] 'ode' returns constant values for the variables
Hermes
herozigle at gmail.com
Tue Jan 23 13:48:40 CET 2018
Hello,
I try to solve the sisytema with the help of "ode".
But I can not find where the error is; in the solution it returns constant
values for the variables.
I think the error is that I have not correctly declared the dependence of
the variable variables "t".
The expected solution should allow the graph to be reproduced:
<http://mailinglists.scilab.org/file/t497622/Solution_expected_fromODE.jpg>
clear;
funcprot(0);
//Draghilev's Method
timer();
function Sys=F(x)
Sys=[];
x0=x(1);x1=x(2);
Sys(1)=x1.^2+x0.^2 -8;
Sys(2)=sin(x0.*x1).*sin(exp(x0.*x1));
endfunction
function Sys=F0(x)
Sys=[];
x00=x(1);x01=x(2);
Sys(1)=x01.^2+x00.^2-8;
Sys(2)=sin(x00.*x01).*sin(exp(x00.*x01));
endfunction
function Sys=Mp(v)
[Sys]=F(v(1:2))-v(3)*F0(ics(1:2));
endfunction
//deff('Sys=Mp(v)','[Sys]=F(v(1:2))-v(3).*F0(ics([1:2]))')
function Sys=NF(v)
Sys=[];
[Sys]=numderivative(Mp,v);
endfunction
//
//Z=NF
//
function D=ODEs(ZZ)
A=ZZ(:,1:2);b=ZZ(:,$);
A1=A;A1(:,1)=b;
A2=A;A2(:,2)=b;
D=-det(A);
d(1)=det(A1) ; d(2)=det(A2); d(3)=D;
[D]=-d;
endfunction
ics=[2;1]//[2.784;-0.5];[2;-0.5];
yint1=fsolve(ics,F)
ics=[yint1];
disp(F(yint1),"x->f(x)=0",ics,"x f(x)=0")
ics=[ics;1];
disp(ics)
function [dxdt]=odes(t,x)
[dxdt]=ODEs(NF(x));
endfunction
N=200;
smin=0.0;
smax=15;
h=0.000001;
step=smax/N;
t=smin:step:smax;
t0=0;
atol=h;
LL= ode("fix",ics,t0,t,atol,odes)
disp(timer(),"tiempo de ejecucion C");
clf();
subplot(1,2,1);
a=get("current_axes")//get the handle of the newly created axes
a.axes_visible="on"; // makes the axes visible
a.font_size=3; //set the tics label font size
a.x_location="middle"; //set the x axis position
plot(t,LL(1,1:$),"-cya",t,LL(2,1:$),"-g",t,LL(3,1:$),"-r")
Gracias
--
Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
More information about the users
mailing list