Rf(CA+1)=(solve( Vb(CA+1) == pi *( r_cyl^2 * zw(CA) + ( za(CA) -zw(CA) )* (x^2) - ( za(CA)^3 - zw(CA)^3 )/3 ) ,x))
It says unable to perform assignment since left and right side have different elements.Can anyone help us out?

 채택된 답변

Walter Roberson
Walter Roberson 2020년 12월 28일

0 개 추천

The equation involves x^2 so you should expect an even number of solutions not one solution.

댓글 수: 2

AHAMMED AFZAL
AHAMMED AFZAL 2020년 12월 28일
Thanks for your response
What if I want to store the positive root for x in Rf(CA+1)?
The below code allows for a small bit of imaginary component due to numeric round-off. You might need to adust the tolerance.
tol = 1e-12;
temp = solve( Vb(CA+1) == pi *( r_cyl^2 * zw(CA) + ( za(CA) -zw(CA) )* (x^2) - ( za(CA)^3 - zw(CA)^3 )/3 ) ,x);
temp( abs(imag(temp)) > tol || real(temp) < 0) = [];
temp = real(temp);
if isempty(temp)
Rf(CA+1) = nan;
else
Rf(CA+1) = max(temp);
end

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

제품

릴리스

R2020b

태그

질문:

2020년 12월 28일

댓글:

2020년 12월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by