# MATLAB: How to solve multiple equations dependent on each other

dependent on each other

Hi
How to code this situation?
I have two equations, which are dependent on each other. Y=2X+5—-(1) and X=2Y+5—–(2) The initial value of X=1, then I have to solve these equation repeatedly for 10 times.
Thanks

x = ones(1,10); % also contains your initial xy = ones(1,10); % just to preallocate y as wellfor i=1:9              % loop 9 times  y(i) = 2*x(i) + 5;   % calculate the y-value  x(i+1) = 2*y(i) + 5; % calculate the 'next' x-valueendy(10) = 2*x(10) + 5;   % finish off by calculating the final y-value
x = 1;for i=1:9  y = 2*x + 5; % calculate the y-value  x = 2*y + 5; % calculate the 'next' x-valueendy = 2*x + 5;