필터 지우기
필터 지우기

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

조회 수: 3 (최근 30일)
Natalie Haddadeen
Natalie Haddadeen 2018년 9월 23일
편집: David Goodmanson 2022년 7월 10일
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
  댓글 수: 11
Jan
Jan 2022년 7월 9일
@David Goodmanson: Breanda is not the OP.
Torsten
Torsten 2022년 7월 9일
편집: Torsten 2022년 7월 9일
The path given in
addpath('C:\Users\myname\Documents\MATLAB\myfunctions')
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.

댓글을 달려면 로그인하십시오.

답변 (1개)

David Goodmanson
David Goodmanson 2022년 7월 10일
편집: David Goodmanson 2022년 7월 10일
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)
quiver(x,y,u,v,0,'showarrowhead',0)
grid on
axis equal
xlabel('x')
ylabel('y')

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by