fixed point iteration and plotting iteration
6 次查看(过去 30 天)
显示 更早的评论
I have a map
such that
,
where
is closed unit disc in
and define
where ,
taking
,
, 
, i want a matlab code whch calculates
iteration for
in a table format and plots these iteration in
. i will be thankful if someone could help me with it.
2 个评论
David Goodmanson
2023-9-18
Hi Akansha, the statement x_n+1 = (1-lambda)x_n + lambda x_n appears to be incorrect since the outcome is the uninteresting x_n+1 = x_n. Also, how does T enter into it?
采纳的回答
Voss
2023-9-19
T = @(xy)xy([2 1]).*[-1 1];
n_iterations = 20;
lambda = [0.1 0.2 0.3 0.4];
n_lambda = numel(lambda);
result = cell(1,n_lambda);
for jj = 1:n_lambda
xy = zeros(n_iterations,2);
xy(1,:) = [0.5 1];
for n = 1:n_iterations
xy(n+1,:) = (1-lambda(jj))*xy(n,:) + lambda(jj)*T(xy(n,:));
end
result{jj} = array2table(xy,'VariableNames',{'x','y'},'RowNames',compose('%d',(0:n_iterations).'));
end
figure
hold on
for jj = 1:n_lambda
plot(result{jj}.x,result{jj}.y)
end
legend("lambda = "+lambda,'Location','NorthWest')
result{:}
3 个评论
Manahel
2025-5-8
How can I save both the graph and the iteration result tables into a PDF file in MATLAB? Also, where can we find an explanation for each step in the code so we can understand it better
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
