Plotting and calculation of iteration of fixed point

5 visualizzazioni (ultimi 30 giorni)
I have a linear transformation such that and i have a sequence (not related to x coordinate) such that iteration is defined like
,
where
Taking , and iterations for
How do i write a matlab code which calculates for (in a table format) and plots the iteration in a plot. i would be helpful if someone could help me with it since i'm new to MATLAB.

Risposta accettata

Voss
Voss il 19 Set 2023
Here's something:
T = @(xyz)-0.5*xyz;
lambda = 0.5;
n_iterations = 20;
xyz = zeros(n_iterations+1,3);
xyz(1,:) = [3 2 1];
for n = 1:n_iterations
xyz(n+1,:) = (1-lambda)*xyz(n,:) + lambda*T(xyz(n,:));
end
result = array2table(xyz,'VariableNames',{'x','y','z'},'RowNames',compose('%d',(0:n_iterations).'));
plot3(result.x,result.y,result.z,'.-')
xlabel('x')
ylabel('y')
zlabel('z')
box on
axis equal
disp(result)
x y z __________ __________ __________ 0 3 2 1 1 0.75 0.5 0.25 2 0.1875 0.125 0.0625 3 0.046875 0.03125 0.015625 4 0.011719 0.0078125 0.0039062 5 0.0029297 0.0019531 0.00097656 6 0.00073242 0.00048828 0.00024414 7 0.00018311 0.00012207 6.1035e-05 8 4.5776e-05 3.0518e-05 1.5259e-05 9 1.1444e-05 7.6294e-06 3.8147e-06 10 2.861e-06 1.9073e-06 9.5367e-07 11 7.1526e-07 4.7684e-07 2.3842e-07 12 1.7881e-07 1.1921e-07 5.9605e-08 13 4.4703e-08 2.9802e-08 1.4901e-08 14 1.1176e-08 7.4506e-09 3.7253e-09 15 2.794e-09 1.8626e-09 9.3132e-10 16 6.9849e-10 4.6566e-10 2.3283e-10 17 1.7462e-10 1.1642e-10 5.8208e-11 18 4.3656e-11 2.9104e-11 1.4552e-11 19 1.0914e-11 7.276e-12 3.638e-12 20 2.7285e-12 1.819e-12 9.0949e-13

Più risposte (0)

Prodotti


Release

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by