tried solution
clear
clc
clf
function ydot=f(x)
ydot=x^2-(exp(-x)*y)
endfunction
x0=0 // initial x value
y0=0 // initial y value
x=0:.1:5 // x range
y=ode(y0,x0,x,f)
plot(x,y,'.-')
xtitle( 'Plot of Y vs X','X axis', 'Y axis')
// Display of the solution
sol='[x;y]'
disp('The solution is')
disp(sol)
getting error
in builtin exec( C:\Users\s b rakes\Desktop\SCI\2.sce line -1 )
Wrong number of input arguments.
ode: An error occurred in 'lsoda' subroutine.
I dont know why I am getting this error. Any body has solution or reason
you are missing one argument (y
) in the rhs:
function ydot=f(x,y)
ydot=x^2-(exp(-x)*y)
endfunction
You should also remove the quotes there:
sol=[x;y]