Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

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

1 visualización (últimos 30 días)
Atique Khan
Atique Khan el 30 de Oct. de 2018
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
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)

Respuestas (1)

Abhishek Kumar
Abhishek Kumar el 9 de Jul. de 2019
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.

La pregunta está cerrada.

Productos


Versión

R2013b

Community Treasure Hunt

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

Start Hunting!

Translated by