(5pts) Vectorize this code! Write one assignment statement that will accomplish exactly the same thing as the give code (assume that the variable mat has been initialized).
[r, c] = size(mat);
for i = 1:r
for j = 1:c
mat(i,j) = 2*mat(i,j)^2 – 6*mat(i,j)+1;
end
end
Use Matlab
mat = 2*mat.^2 - 6*mat+1
Get Answers For Free
Most questions answered within 1 hours.