Gui: equation solving calculator
14 次查看(过去 30 天)
显示 更早的评论
Hi, I’m making an application that will be able to solve equations using the solve function, but I get an error when trying to calculate equations like x-4, what’s wrong, tell me please
Error in
matlab.graphics.internal.figfi le.FigFile/read>@(hObject,eventdata)super _program('pushbutton5_Callback ',hObject,eventdata,guidata(hO bject))
Error while evaluating UIControl Callback.
function pushbutton5_Callback(hObject, eventdata, handles)
eqn = get(handles.edit1);
X = solve(eqn);
set(handles.edit1,'string',X);
0 个评论
回答(1 个)
David Hill
2020-6-6
Not sure if this will help.
eqn ='a*x^2+b*x+c';
var = symvar(eqn);
for k=1:length(var)
syms(var{k});
end
EQN=eval(eqn)==0;
X=solve(EQN,x);
2 个评论
另请参阅
类别
在 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!