% script26.m % find the errors in this script % original script % script26.m % find the errors in this script % A=[ 1 2 3 4; dsp(num2str(A)); b=a^2; disp('the values of b are ' b) c=2 a; x=2*y+10; disp(num2str(A(5))); % corrected script % A=[ 1 2 3 4; % missing closing bracket %(corrected) A=[ 1 2 3 4]; dsp(num2str(A)); % disp is mis-spelled %(corrected) disp(num2str(A)); b=a^2; % variable a is not defined. MATLAB is case sensitive %(corrected) b = A^2; disp('the values of b are ' b) % disp() needs a single string, use concatenation % b is not defined; needs to be a string %(corrected) disp(['the values of b are ' num2str(b)]) c=2 a; % missing arithmetic operator %(corrected) c=2-a; x=2*y+10; % variable y is not defined %(corrected) x=2*A+10; (or some other expression with a known variable; or define y disp(num2str(A(5))); % variable A has only 4 values, A(5) is not defined %(corrected) disp(num2str(A(3)));