MATLAB Answers

How to get all positive values of 'm' from the given domain of two variables?

1 ビュー (過去 30 日間)
Atique Khan
Atique Khan 2018 年 10 月 30 日
回答済み: Abhishek Kumar 2019 年 7 月 9 日
I have an equation in two variables naming a and b with domains 0.5 to 1 with step size equal to 0.01 for both a and b. I want to have all values of a and b on which the m results a positive number. The equation is given as and denominator is given separately. I make use of for loop to do so but it didnt work and I am new around with MATLAB to know the exactly how can I do this to be done.
m(a,b)= (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
where
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)

  0 件のコメント

サインインしてコメントする。

回答 (1 件)

Abhishek Kumar
Abhishek Kumar 2019 年 7 月 9 日
i=1;
j=1;
cans=zeros(1,10);
lans=zeros(1,10);
for a=0.5:0.01:1
for b=0.5:0.01:1
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;
if m>0
cans(i)=a;
lans(i)=b;
i=i+1;
end
end
end
Try this code
works fine for me.
'cans' stores the value of 'a' and 'lans' stores the value of 'b' at the same index.

  0 件のコメント

サインインしてコメントする。

製品


リリース

R2013b

Community Treasure Hunt

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

Start Hunting!

Translated by