So I'm graphing the following (note: I'm also graphing a direction field) and when I plot it the graph stops when x=10. Any suggestions?
fishfun = @(y) (1.2*y.^2)/1+y.^2;
y=linspace(0,10,200);
%(1.2*y.^2)./(1+y.^2); %we generated TWO vectors 1.2y^2 and 1+y^2. To get
%the quotient, we need to divide COMPONENT WISE.
plot(y,(.65*y)-(0.65*y.^2/10.5));
title('Graph of Rainbow Trout')
ylabel('Amount of fish (hundreds)')
xlabel('Time (days)')
hold on
f= @ (t,y) (.65*y)-(0.65*y.^2/10.5)-(((1.2*(y^2))/(1+(y^2))));
dirfield(f,0:1:30, 0:.05:2)
title 'Direction Field of Rainbow Trout'

1 Comment

what is dirfield? Code can be checked if dirfield is known.

Sign in to comment.

 Accepted Answer

the cyclist
the cyclist on 16 Feb 2016
Edited: the cyclist on 16 Feb 2016
In the first plot, it's because in this line:
y=linspace(0,10,200);
you define that y ranges from 0 to 10.
I can't run dirfield, so I'm not sure about the second plot.

1 Comment

Second plot is the exact same problem, thanks!

Sign in to comment.

More Answers (0)

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Asked:

on 16 Feb 2016

Commented:

on 16 Feb 2016

Community Treasure Hunt

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

Start Hunting!