How can you make an input to a symbolic variable?
1 回表示 (過去 30 日間)
古いコメントを表示
varprompt='Enter Variable (space-separated):';
var=inputdlg(varprompt);
syms(sym(string(var)));
eqprompt='Enter Equation (from highest to lowest degree):';
equation=inputdlg(eqprompt);
k=diff(equation)
I dont know what to do. How do you make the program solve the equation? Im having trouble turning the var input to a symbolic variable so that i can use it to solve the equation.
0 件のコメント
採用された回答
madhan ravi
2020 年 10 月 27 日
equation = {'x^2 + x'};
diff(str2sym(equation))
equation = {'x^2 + y'};
eq = str2sym(equation);
syms(symvar(eq))
diff(str2sym(equation), x)
0 件のコメント
その他の回答 (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!