Plotting a piecewise function for an arbitrary itration and then take intersection of them.

1 vue (au cours des 30 derniers jours)
My function is this :
s(x)= piecewise(0<= x < 1/3 , mod(x+1/4, 1), 1/3<= x < 2/3 , mod(x+1/2, 1), 2/3<= x <=1 , mod(x+5/6 , 1);
I want to plott s^k(x) for k= 1 , ... , n. I want to see them in one diagram at the same time. and then I want to see the intersection of s^k(x) for k=1 , ..., n.

Réponses (1)

Torsten
Torsten le 1 Juin 2021
n=5;
nx=50;
x1=linspace(0,1/3,nx);
x2=linspace(1/3,2/3,nx);
x3=linspace(2/3,1,nx);
X = [x1(1:nx-1).';x2(1:nx-1).';x3.');
Y1=zeros(nx-1,n);
Y2=zeros(nx-1,n);
Y3=zeros(nx,n);
for i=1:n
x1 = mod(x1+0.25,1);
x2 = mod(x2+0.5,1);
x3 = mod(x3+5/6,1);
Y1(:,i) = x1(1:nx-1);
Y2(:,i) = x2(1:nx-1);
Y3(:,i) = x3;
end
Y = [Y1;Y2;Y3];
plot(X,Y)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by