plotting several quadratic functions

1 Ansicht (letzte 30 Tage)
ahmed-wali
ahmed-wali am 15 Nov. 2012
Beantwortet: Dr am 18 Okt. 2022
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

Akzeptierte Antwort

Grzegorz Knor
Grzegorz Knor am 15 Nov. 2012
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')

Weitere Antworten (1)

Dr
Dr am 18 Okt. 2022
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')

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by