Thanks, I think I understand how to do the first part now although I am still struggling with the second part. Is there anyone who could give me the specific code to program it?
Calculating values from an iterative map
2 ビュー (過去 30 日間)
古いコメントを表示
I need to write a Matlab code that will calculate the x10 value for the following iterative map that doesn't use fsolve,\ or inv commands, given x0= -3.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/148002/image.jpeg)
I also need a code that will calculate:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/148003/image.jpeg)
for the same iterative map.
Any help would be very appreciated :)
回答 (2 件)
Walter Roberson
2015 年 8 月 13 日
Use a "for" loop. Inside the "for" use "if" and "elseif".
2 件のコメント
Walter Roberson
2015 年 8 月 13 日
x(1) = 0;
for n = 1 : 10
xn = x(n);
first_expression = some calculation with xn
second_expression = some other calculation with xn
if first_expression < second_expression
xn1 = some result calculated with xn
else
....
if third_expression < fourth_expression
...
xn1 = ...
else
...
xn1 = ....
end
end
x(n+1) = xn1
end
Purushottama Rao
2015 年 8 月 13 日
for the second part,
s=0;
for n=4:8
k=(x(n-1)-2)+(x(n-1)+1);
s=s+k;
end
disp(s)
参考
カテゴリ
Help Center および File Exchange で Assumptions についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!