Plot function is not working
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Juan Pablo Arango
am 7 Okt. 2019
Kommentiert: Juan Pablo Arango
am 7 Okt. 2019
I'm having problem plotting some function from my homework assignment. I created a code similar in structure to what I am trying to do. Same problem, the graph is not showing. Do you guys have any clue what to do here?
The code is given as follows:
n = 1;
h = 0.05;
t(n) = 0;
y(n) = 0;
while t(n)+h < 8
y(n+1) = pi^(-n^2);
t(n+1) = t(n) + h;
n = n + 1;
end
plot(t(n),y(n))
0 Kommentare
Akzeptierte Antwort
the cyclist
am 7 Okt. 2019
Bearbeitet: the cyclist
am 7 Okt. 2019
Your plotting code is trying to select just one element from the t and y vectors.
I think you want this instead:
plot(t,y)
(I changed my answer a bit after your edit.)
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Graphics Performance finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!