The code doesn't generate a graph. Please tell where I am doing wrong.
Ältere Kommentare anzeigen
clc, clear, close all
x = 1;
for n = 1:30
y = (7259/14520)*x + 167/2420
plot(n,y,'color','m')
hold on
x = y;
end
Antworten (1)
You have to use a marker, as you are plotting point by point.
x = 1;
for n = 1:30
y = (7259/14520)*x + 167/2420
plot(n,y,'.','color','m')
hold on
x = y;
end
3 Kommentare
Save the result into arrays and plot at once.
x = 1;
y = zeros(1,30) ;
for n = 1:30
y(n) = (7259/14520)*x + 167/2420 ;
x = y(n);
end
plot(1:30,y,'.-','color','m')
MUDASIR MALIK
am 5 Apr. 2022
KSSV
am 5 Apr. 2022
Thanks is accepting/ voting the answer.
Kategorien
Mehr zu 2-D and 3-D Plots finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

