excuse could someone correct or modify this routine

X(1)=1;
For i=1:100
Disp(x)
X(i+1)=sin(x(i))
End

댓글 수: 1

Quisiera que por favor alguien me ayudara la rutina da muchos valores solo quisiera saber si se puede modificar para que de solo los cien valores

댓글을 달려면 로그인하십시오.

 채택된 답변

Walter Roberson
Walter Roberson 2018년 8월 1일
X(1)=1;
for i=1:100
disp(x(i))
X(i+1)=sin(x(i));
end

추가 답변 (1개)

jose guevara
jose guevara 2018년 8월 1일

0 개 추천

friend excuse my question is if you can modify the algorithm to prevent me from that amount of values and only the hundred that I ask could you please help me

댓글 수: 4

Dennis
Dennis 2018년 8월 1일
편집: Dennis 2018년 8월 1일
X(1)=1;
for i=1:100
X(i+1)=sin(x(i));
end
disp(x(100))
Note: the 100'th output is x(100), the way Dennis shows. But you also compute the 101'st output, which will be at x(101)
I was thinking exactly the same and even edited it. Then i realised that we display x and not X.
Oh, good point. So it would be
X(1)=1;
for i=1:100
X(i+1)=sin(x(i));
end
disp(X(100))
or
disp(X(101))

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Parallel Computing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by