How do I write an inductive sequence?
7 ビュー (過去 30 日間)
古いコメントを表示
I need to put in the sequence x(subscriptn)=4x(subscript n-1)[1-x(subscript n-1)]. I have x0.
2 件のコメント
John D'Errico
2020 年 4 月 12 日
I would point out that everything you need to know about something basic like this is already explained in depth, in the getting started tutorials.
In there, you will learn what a vector is. How to index a vector. How to write a loop.
I know. Reading the manual is boring. They put all that useful information in there, and you are in a hurry, so we need to re-write the manual for you, one part at a time.
採用された回答
Torsten
2020 年 4 月 12 日
N = 10; % define number of recurrence terms to be calculated
x = zeros(N,1);
x(1) = 3; % define x0
for n = 2:N
x(n) = 4*x(n-1) * (1 - x(n-1)); %calculate the xi
end
x
その他の回答 (0 件)
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!