hi,i I'm pretty new in matlab .i wanna write the program to calculate real roots of quadradic equation with nested function.
function[x1,x2]= quadratic(a,b,c) d=0 disc; function disc d = sqrt(b^2-4*a*c); end disc; x1 =(-b + d)/(2*a); x2 =(-b - d)/(2*a); endError:File: quadratic2.m Line: 6 Column: 11Identifier 'd' is not a function or a shared variable. To share 'd' with nested function, initialize it in the currentscope. For more information, see Sharing Variables Between Parent and Nested Functions.
i have no idea what should i do…
Best Answer