# For loop for and equations in two variable.

1 view (last 30 days)
Atique Khan on 29 Oct 2018
Edited: dpb on 29 Oct 2018
I am preparing a code regarding to solve three equation that depend on two same variables and want to have all the positive roots for all the three equations.
t1=input('left end point of domain');
t2=input('right end point of domain');
c=input('increment of domain');
for a=t1:c:t2
for b=t1:c:t2
d=15*a^6 + 45*a^4*b^2 + 64*a^3*b^3 + 45*a^2*b^4 + 15*b^6 - ...
64*sqrt(a^2+b^2)*(a^5 + a^3*b^2 + a^2*b^3 + b^5);
m = (4*(a^2+b^2)^(3/2)*(-8*a^3+8*a^3*b^3 + ...
sqrt(a^2+b^2)*(a^2+7*a^5+b^2+7*a^3*b^2-8*a^2*b^3-8*b^5)))/d;
mt= -((4*(a^2+b^2)*(8*a^7+16*a^5*b^2-a^4*(1+7*b^3)) - ...
2*a^2*(b^2+7*b^5)-b^3*(b+7*b^4-8*sqrt(a^2+b^2)) + ...
8*a^3*b^3*(b-sqrt(a^2+b^2)))/d);
m0= 1 - (2* ((4* (a^2 + b^2)^(3/2)*(-8* a^3 + 8 *a^3* b^3 + sqrt(a^2 + b^2)*(a^2 + 7* a^5 + b^2 + 7* a^3 *b^2 - 8* a^2* b^3 - 8* b^5)))/d) - (4* (a^2 + b^2)* (8* a^7 + 16 *a^5 *b^2-a^4*(1 + 7* b^3)-2 *a^2 *(b^2 + 7* b^5) - b^3* (b + 7* b^4 - 8* sqrt(a^2 + b^2)) + 8* a^3 *b^3* (b - sqrt(a^2 + b^2))))/d);
end
end
regards

R2013b

### Community Treasure Hunt

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

Start Hunting!