Can someone please fix my matlab code? Don't know how to get rid of the warning: Unable to solve symbolically. Returning a numerical solution using vpasolve.
    3 ビュー (過去 30 日間)
  
       古いコメントを表示
    
% Values of constants
syms r V L h
r = 0.3;
V = 0.35;
L = 3;
eqn = (0.5*pi*r^2-r^2*asin(h/r)-h*sqrt(r^2-h^2))*L == V;
answer = solve(eqn, h)
depth = r - answer
4 件のコメント
  Star Strider
      
      
 2020 年 5 月 6 日
				The warning is not the problem.  
It is not possible to solve symbolically for ‘h’.  A numerical solution is the best you can do.
採用された回答
  Walter Roberson
      
      
 2020 年 5 月 6 日
        r = 0.3;
You used one significant digit in your coefficients. In science that means that r is some undetermined value in the range 25/100 inclusive to 35/100 exclusive. And since your input coefficients are indeterminate, it is a category mistake to request an infinitely precise closed form solution, which is what solve() is designed to do. You should be using vpasolve or a numeric technique such as fzero()
3 件のコメント
  Walter Roberson
      
      
 2020 年 5 月 6 日
				% Values of constants
syms h
r = 0.3;
V = 0.35;
L = 3;
eqn = (0.5*pi*r^2-r^2*asin(h/r)-h*sqrt(r^2-h^2))*L == V;
answer = vpasolve(eqn, h)
depth = r - answer
その他の回答 (0 件)
参考
カテゴリ
				Help Center および File Exchange で Symbolic Math Toolbox についてさらに検索
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!