Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The pushbutton callback function below is from a GUI which uses thr quadratic fo

ID: 3695367 • Letter: T

Question

The pushbutton callback function below is from a GUI which uses thr quadratic formula to calculate the squareroots of a 2nd-order linear equation. (The quadiatic formula is: x = -b plusminus squareroot b^2 -4ac/2a) There are ERRORS in the code Please indicate and correct those coding errors %---Executes on button press m pushbutton1. function pushbutton 1_Callback(hObject eventdata handles) a = str2dbl(get(handles.edit1, String)); b = str2dbl(get(handles.edit2, String)); c = str2dbl(get(handles.edit3, String)); x1 = (-b + sqr(b^2 - 4*a*c))/2*a x2 = (-b - sqr(b^2 - 4*a*c))/2*a set (handles.text1, String,x1); set (handles.text2, String,x1);

Explanation / Answer

1) str2dbl is wrong, correcr one is str2double

2) sqr is wrong sqrt is correct

3) Error in get( handles.edit1, String)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote