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

조회 수: 6 (최근 30일)
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.

답변 (1개)

Torsten
Torsten 2021년 6월 1일
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)

카테고리

Help CenterFile Exchange에서 Database Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by