plotting several quadratic functions

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

 Risposta accettata

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

Più risposte (1)

Dr
Dr il 18 Ott 2022

0 voti

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

Categorie

Scopri di più su 2-D and 3-D Plots in Centro assistenza e File Exchange

Tag

Richiesto:

il 15 Nov 2012

Risposto:

Dr
il 18 Ott 2022

Community Treasure Hunt

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

Start Hunting!

Translated by