For loop for and equations in two variable.

조회 수: 1 (최근 30일)
Atique Khan
Atique Khan 2018년 10월 29일
편집: dpb 2018년 10월 29일
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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

제품


릴리스

R2013b

Community Treasure Hunt

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

Start Hunting!

Translated by