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

 채택된 답변

Grzegorz Knor
Grzegorz Knor 2012년 11월 15일

0 개 추천

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
Dr 2022년 10월 18일

0 개 추천

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')

카테고리

도움말 센터File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

질문:

2012년 11월 15일

답변:

Dr
2022년 10월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by