??? Undefined function or variable 'x'
Show older comments
I am trying to use ode45 to solve a system of ODEs.
What I did was:
function Testfunction
tspan = [...]
%specify initial conditions
x0 = [...,...,...,...]
[t,x] = ode45(@somefn, tspan, x0)
%defining the output variables
y=x(:,1);
etc...
%plot stuff
plot(...)
return
%now define somefn
function g = somefn(t,x)
g = zeros(size(x));
g(1) = y;
etc...
return
But when I tried to run this code MATLAB keeps saying ??? Undefined function or variable 'x' in somefn
please could someone help me? Thanks.
Accepted Answer
More Answers (0)
Categories
Find more on Programming in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!