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

3 次查看(过去 30 天)
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

采纳的回答

Dyuman Joshi
Dyuman Joshi 2023-5-15
"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

更多回答(1 个)

KSSV
KSSV 2023-5-15
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

类别

Help CenterFile Exchange 中查找有关 Symbolic Math Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by