plotting several quadratic functions
4 次查看(过去 30 天)
显示 更早的评论
would like to plot 3 to 4 qaudratic functions (a*x^2+1) on the same coordinates by changing the value of a from -1:1:2. can i use the for loop for this? many thanks
0 个评论
采纳的回答
Grzegorz Knor
2012-11-15
Yes, I think that it is good idea:
figure
hold all
x = linspace(0,1);
for a=-1:1:2
plot(x,a*x.^2+1)
end
hold off
legend('a=-1','a=0','a=1','a=2')
更多回答(1 个)
Dr
2022-10-18
figure
hold all
x = linspace(0,1);
for a=-1:1:2
plot(x,a*x.^2+1)
end
hold off
legend('a=-1','a=0','a=1','a=2')
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!