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)?
Walter Roberson
Walter Roberson 2020 年 12 月 28 日
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 件)

カテゴリ

製品

リリース

R2020b

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by