필터 지우기
필터 지우기

The graph is not displayed

조회 수: 2 (최근 30일)
Mathew Aibinu
Mathew Aibinu 2023년 8월 26일
답변: Dyuman Joshi 2023년 8월 26일
close all
clear all
x0 = 100;
r=1.02;
for j=1:1:5
x(1) = x0;
x(j+1) = r*x(j);
end
plot(j, x(j))
grid on

채택된 답변

Dyuman Joshi
Dyuman Joshi 2023년 8월 26일
x0 = 100;
r=1.02;
%Bring the assignment out of loop, as it is not affected by the loop
x = x0;
%Define indices to loop over
j = 1:5;
for k=j
x(k+1) = r*x(k);
end
%Plot with markers to show the data points
plot(j,x(j),'bo-')
grid on

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

제품


릴리스

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by