I have some problem when plotting the graph, anyone can help? Thanks

1 visualizzazione (ultimi 30 giorni)
This is my code
for x = -10:10
y = 2^(0.4*x)+5
plot(x,y,'g')
end

Risposta accettata

Salaheddin Hosseinzadeh
Salaheddin Hosseinzadeh il 27 Giu 2015
Modificato: Salaheddin Hosseinzadeh il 27 Giu 2015
Hi,
You need to store y first.
x = -10:10;
for i = 1:numel(x)
y(i) = 2^(0.4*x(i))+5
end
plot(x,y,'g')

Più risposte (0)

Categorie

Scopri di più su Loops and Conditional Statements in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by