fixed point iteration and plotting iteration

7 visualizaciones (últimos 30 días)
Akansha
Akansha el 16 de Sept. de 2023
Comentada: Manahel el 8 de Mayo de 2025
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 comentarios
David Goodmanson
David Goodmanson el 18 de Sept. de 2023
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?
Akansha
Akansha el 20 de Sept. de 2023
sorry my mistake, iteration is given by x_n+1 = (1-lambda)x_n + lambda T(x_n)

Iniciar sesión para comentar.

Respuesta aceptada

Voss
Voss el 19 de Sept. de 2023
Assuming the sequence is defined as in your other question, here's something:
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{:}
ans = 21×2 table
x y ________ ________ 0 0.5 1 1 0.35 0.95 2 0.22 0.89 3 0.109 0.823 4 0.0158 0.7516 5 -0.06094 0.67802 6 -0.12265 0.60412 7 -0.1708 0.53145 8 -0.20686 0.46122 9 -0.2323 0.39441 10 -0.24851 0.33174 11 -0.25683 0.27372 12 -0.25852 0.22066 13 -0.25473 0.17274 14 -0.24654 0.13 15 -0.23488 0.092343
ans = 21×2 table
x y _________ _________ 0 0.5 1 1 0.2 0.9 2 -0.02 0.76 3 -0.168 0.604 4 -0.2552 0.4496 5 -0.29408 0.30864 6 -0.29699 0.1881 7 -0.27521 0.091078 8 -0.23839 0.01782 9 -0.19427 -0.033421 10 -0.14873 -0.065591 11 -0.10587 -0.08222 12 -0.068251 -0.08695 13 -0.037211 -0.08321 14 -0.013127 -0.07401 15 0.0043006 -0.061834
ans = 21×2 table
x y _________ _________ 0 0.5 1 1 0.05 0.85 2 -0.22 0.61 3 -0.337 0.361 4 -0.3442 0.1516 5 -0.28642 0.00286 6 -0.20135 -0.083924 7 -0.11577 -0.11915 8 -0.045293 -0.11814 9 0.0037363 -0.096284 10 0.031501 -0.066278 11 0.041934 -0.036944 12 0.040437 -0.013281 13 0.03229 0.0028345 14 0.021753 0.011671 15 0.011726 0.014696
ans = 21×2 table
x y __________ __________ 0 0.5 1 1 -0.1 0.8 2 -0.38 0.44 3 -0.404 0.112 4 -0.2872 -0.0944 5 -0.13456 -0.17152 6 -0.012128 -0.15674 7 0.055418 -0.098893 8 0.072808 -0.037169 9 0.058552 0.0068219 10 0.032402 0.027514 11 0.0084359 0.029469 12 -0.0067262 0.021056 13 -0.012458 0.0099431 14 -0.011452 0.00098262 15 -0.0072643 -0.0039913
  3 comentarios
Voss
Voss el 20 de Sept. de 2023
You're welcome!
Manahel
Manahel el 8 de Mayo de 2025
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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Graphics en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by