๐‘‹๐‘›+1 = ๐‘‹๐‘› 2 + 0.25
Considering the relation, calculate and record the value of the relation for each value of n,
Write a computer program that will output the result for only n = 0, 5, 10, 15,โ€ฆ values.
n = 0,1,2,3,โ€ฆ., N
N=54

๋Œ“๊ธ€ ์ˆ˜: 4

David Hill
David Hill 2021๋…„ 5์›” 24์ผ
What have you done? You need a starting value of X at some point, for example X(12)=5 or X(0)=1.
polat kayhan
polat kayhan 2021๋…„ 5์›” 24์ผ
x(0)=0
polat kayhan
polat kayhan 2021๋…„ 5์›” 24์ผ
you can give the first value yourself x(0)= 1 or x(0)= 0
Image Analyst
Image Analyst 2021๋…„ 5์›” 25์ผ
There is something missing between the n and the 2.
Do you mean x(n+1) = x(n) * 2 + 0.25 or what????
n = 0 : N
x(1) = 0;
for k = 2 : length(n)
index = n(k) + 1; % Index can't start at 0. It needs to start at 1.
x(index + 1) = x(index) * 2 + 0.25;
end
x % Show x for all values of n in command window.

๋Œ“๊ธ€์„ ๋‹ฌ๋ ค๋ฉด ๋กœ๊ทธ์ธํ•˜์‹ญ์‹œ์˜ค.

๋‹ต๋ณ€ (2๊ฐœ)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021๋…„ 5์›” 24์ผ

0 ๊ฐœ ์ถ”์ฒœ

Use colon operator ":" to generate the series of x(n+1). And to select or take out only n = 0, 5, 10, 15,โ€ฆ54 values, use again ":", e.g. 1:5:54
Good luck.

๋Œ“๊ธ€ ์ˆ˜: 1

polat kayhan
polat kayhan 2021๋…„ 5์›” 24์ผ
n=0; x_(n+1)=2; x_n=1;
for n= 0:1:54;
x_(n+1)= (x_n)^2+(1/4);
n=n+1;
end
for n=0:5:54;
x_(n+1)= (x_n)^2+(1/4);
disp(x_(n+1))
n=n+5;
end
is it correct ?

๋Œ“๊ธ€์„ ๋‹ฌ๋ ค๋ฉด ๋กœ๊ทธ์ธํ•˜์‹ญ์‹œ์˜ค.

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021๋…„ 5์›” 24์ผ

0 ๊ฐœ ์ถ”์ฒœ

What you are computing is not quite correct. But you have done some attempt.
Here is a simple solution
n = 1:54;
x(1)=0;
for ii = n
x(ii+1)=x(ii)^2+.25;
end
X_out = x(1:5:54);
OUT = [(0:5:54);X_out];
fprintf(' n Output: \n')
fprintf('x(%d) = %f \n', OUT)

๋Œ“๊ธ€ ์ˆ˜: 2

polat kayhan
polat kayhan 2021๋…„ 5์›” 24์ผ
thank you very much <3
Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021๋…„ 5์›” 24์ผ
ํŽธ์ง‘: Sulaymon Eshkabilov 2021๋…„ 5์›” 25์ผ
So what?

๋Œ“๊ธ€์„ ๋‹ฌ๋ ค๋ฉด ๋กœ๊ทธ์ธํ•˜์‹ญ์‹œ์˜ค.

์นดํ…Œ๊ณ ๋ฆฌ

๋„์›€๋ง ์„ผํ„ฐ ๋ฐ File Exchange์—์„œ Mathematics์— ๋Œ€ํ•ด ์ž์„ธํžˆ ์•Œ์•„๋ณด๊ธฐ

์งˆ๋ฌธ:

2021๋…„ 5์›” 24์ผ

ํŽธ์ง‘:

2021๋…„ 5์›” 25์ผ

Community Treasure Hunt

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

Start Hunting!

Translated by