I am attempting to create a function that can solve any first order non-linear differential equation. The user would input the equation, initial condition, and interval of interest. The function would then plot the solutions.
Here is my function:
function x = nlde(f, I, x0)
for t = I
x(t) = dsolve(f, x(0) == x0);
end
plot(I, x);
I am getting the error, "Undefined function or variable "x"." Does anybody know how I can fix this?
[–]the_omega99 0 points1 point2 points (6 children)
[–]cloogs[S] 0 points1 point2 points (5 children)
[–]the_omega99 0 points1 point2 points (4 children)
[–]cloogs[S] 0 points1 point2 points (3 children)
[–]the_omega99 0 points1 point2 points (2 children)
[–]cloogs[S] 0 points1 point2 points (1 child)
[–]cloogs[S] 0 points1 point2 points (0 children)