Plotting function with differenting constant
Show older comments
Hi,
I'm pretty unexperienced with Matlab so pls bear with me:
I'm trying to plot the function
y=a/(x+1)-(a-x)^2+x/(x+a)
when a is a vector of
a=[1,2,3,50,300]
so I put it in the loop:
for i=1:length(a)
ai=a(i);
y{i}=@(x) (ai/(x+1)-(ai-x)^2+x/(x+ai));
fplot(y{i});
end
but I get just one graph (of ai=300) and tons of yellow warnings..
any comments?
Accepted Answer
More Answers (1)
Torsten
on 19 Jul 2022
Include the command
hold on
after the line
fplot(y{i});
such that preceeding graphs are not overwritten.
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!