# Why is it giving me undefined function for the slope field?

25 views (last 30 days)
Edited: David Goodmanson on 10 Jul 2022
f=@(x,y)(exp(-x)-y)*(exp(-x)+2+y)
slopefield(f,[xmin,xmax],[-10,10],20)
hold on
drawode(f,[-10,10],2,3)
drawode(f,[-10,10],5,7)
hold off
Jan on 9 Jul 2022
@David Goodmanson: Breanda is not the OP.
Torsten on 9 Jul 2022
Edited: Torsten on 9 Jul 2022
The path given in
was just an example.
Once you find the file you search for, you must add the path to this file (i.e. your path) in the way as shown above.

David Goodmanson on 10 Jul 2022
Edited: David Goodmanson on 10 Jul 2022
Hello Brenda,
As an alternative to figuring out how to get that code up and running, or as a comparison, you can run your own code:
xmin = -3; xmax = 6, delx = .3;
ymin = -6; ymax = 6, dely = .3;
[x y]= meshgrid([xmin:delx:xmax],[ymin:dely:ymax])
f=@(x,y)(exp(-x)-y).*(exp(-x)+2+y); % change * to .*
th = atan(f(x,y));
linlen = .2; % line lengths
u = linlen*cos(th);
v = linlen*sin(th);
figure(1)
grid on
axis equal
xlabel('x')
ylabel('y')