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

MatLab problem, why my result has the exceed result a? Write a function in MATLA

ID: 3607440 • Letter: M

Question

MatLab problem, why my result has the exceed result a?

Write a function in MATLAB called apply Threshold that accepts a vector called vec and a scalar value called thresh. The function returns a logical vector representing the values in vec that are greater than thresh Answer: 1 function a-applyThreshold (vec,thresh) a-vec>thresh 4 en Check Test Expected Got XA=[10 20 30; 40 50 60; 70 80 90); disp (all (all(applyThreshold(A, 30) a E [0 0 0; 1 1 1; 1 1 1)))) X A= [10 20 30 ; 40 50 60; 70 80 90]; disp (all (all(applyThreshold(A, 80) [0 0 0,0 0 0; 0 0 1)))) 0 0 1

Explanation / Answer

function a = applyThreshold(vec, thresh)
a = vec > thresh;
end

in matlab you need to end a statement with semicolon otherwise matlab print value of the variable