MATLAB: How to make cosine 1000 times

cosine

Hello everyone,
please can you help me with my problem? I want to make cosine from number 10.
I want to make it like this:
r=10;
A=cos(r);
B=cos(A);
C=cos(B);
...
It should repeat 1000 times and I want to see only the result-not every single step out of those 1000. It would be probably better to use function 'if', but I am not sure how to use it.
Thank you.

Best Answer

Like this?
r=10;
c = cos(r); % Do once to initialize
% Do 999 more times:
for k = 2 : 1000
c = cos(c)
end
Related Question