Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

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

조회 수: 1 (최근 30일)
Atique Khan
Atique Khan 2018년 10월 30일
마감: MATLAB Answer Bot 2021년 8월 20일
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)

답변 (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.

이 질문은 마감되었습니다.

제품


릴리스

R2013b

Community Treasure Hunt

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

Start Hunting!

Translated by