In Matlab:
Given the DrawRect function described in the lecture.
function DrawRect(a, b, L, W, c)
x = [a a+L a+L a a];
y = [b b b+W b+W b];
fill(x, y, c);
end
Which of the following function call will draw a black square with size of 10 by 10 with the center at (5, 0)?
a) DrawRect(0, -5, 10, 10, 'b')
b) DrawRect(5, 0, 10, 10, 'b')
c) DrawRect(0, -5, 10, 10, 'k')
d) DrawRect(5, 0, 10, 10, 'k')
Answer : c)DrawRect(0,-5,10,10,'k')
Explanation :
fill (x,y,c) , creates polygons with given data x and y , Here is 'c' is color. 'k' mean black color.
In given function we are creating x and y using a,b,L,W . Here L and W are length and width . 'a' and 'b' are center of leftmost edge.
After running above function with option c.
output :
***d0 comment for queries and rate me up******
Get Answers For Free
Most questions answered within 1 hours.