Q:

Write a script that will create a two-dimensional patch object with just three vertices and one face connecting them

0

Write a script that will create a two-dimensional patch object with just three vertices and one face connecting them. The x and y coordinates of the three vertices will be random real numbers in the range from 0 to 1. The lines used for the edges should be black with a width of 3, and the face should be grey. The axes (both x and y) should go from 0 to 1. For example, depending on what the random numbers are, the Figure Window might look like the Figure.

Figure Patch object with black edge 

 

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Ch12Ex24.m

% Create a 2D patch object with random vertices

% and just one face

polyhedron.vertices = [...

rand rand rand

rand rand rand

rand rand rand];

polyhedron.faces = [1 2 3];

pobj = patch(polyhedron, ...

 'FaceColor',[0.8, 0.8, 0.8],...

 'EdgeColor','black', 'LineWidth', 3);

axis([0 1 0 1])

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now