solve the equation for one variable and find the value of variable

2 visualizzazioni (ultimi 30 giorni)
if p = [1.0 1.2 2.2 3.4 4.4 6.7 4.2 4.8 6.4 7.4]
solve eqation for a and find the value of a
eqn = p*((1-a^2)^(3/2)) == (a*acosd(a)-(a^2)*sqrt(1-a^2))
a = solve(eqn,a)
gives error Empty sym: 0-by-1

Risposta accettata

Dyuman Joshi
Dyuman Joshi il 15 Mag 2023
"out come is shows only a constant valu s=1 for all value of p
kindly check this error"
That's not an error. a==1 is a solution to all the equations.
To find solution(s) other than a==1, in case more solution(s) exists, you generally obtain them by specifying an initial guess closer to the other solutions. However, as we don't know any other solution, let's assume a guess that is far from the solution we know -
As the allowed values of a are [-1, 1], let's take the initial guess as -0.5
syms a
P = [1.0 1.2 2.2 3.4 4.4 6.7 4.2 4.8 6.4 7.4] ;
s = zeros(size(P)) ;
for i = 1:length(P)
p = P(i);
eqn = p*((1-a^2)^(3/2)) == (a*acosd(a)-(a^2)*sqrt(1-a^2));
s(i)=vpasolve(eqn,a,-0.5);
end
s
s = 1×10
0.0112 0.0134 0.0248 0.0387 0.0503 0.0777 0.0480 0.0551 0.0741 0.0861

Più risposte (1)

KSSV
KSSV il 15 Mag 2023
syms a
P = [1.0 1.2 2.2 3.4 4.4 6.7 4.2 4.8 6.4 7.4] ;
s = zeros(size(P)) ;
for i = 1:length(P)
p = P(i) ;
eqn = p*((1-a^2)^(3/2)) == (a*acosd(a)-(a^2)*sqrt(1-a^2))
s(i) = vpasolve(eqn,a) ;
end
  1 Commento
Arvind
Arvind il 15 Mag 2023
Modificato: Arvind il 15 Mag 2023
out come is shows only a constant valu s=1 for all value of p
kindly check this error

Accedi per commentare.

Categorie

Scopri di più su Symbolic Math Toolbox in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by