MATLAB: How to display a graph after getting user to input in the pop up

user input processing

Question:
A window should pop up that asks the user to input a single variable equation (a.k.a. function) for which the user wishes to find the root.
ii) A graph of this equation should get displayed
My code:
prompt = {'Single variable equation: \color{white} .'};
dlg_title = 'Input';
num_lines = 1;
defaultans = {'x'};
options.Interpreter='tex';
answer = inputdlg(prompt,dlg_title,num_lines,defaultans,options);
func = string(answer{1});
What to do next? New to MATLAB, please help.