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

조회 수: 5 (최근 30일)
Arvind
Arvind 2023년 5월 15일
답변: Dyuman Joshi 2023년 5월 15일
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
  댓글 수: 1
Arvind
Arvind 2023년 5월 15일
편집: Arvind 2023년 5월 15일
out come is shows only a constant valu s=1 for all value of p
kindly check this error

댓글을 달려면 로그인하십시오.

카테고리

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