Cody

Problem 1744. Make a Plot with Functions

Solution 2162666

Submitted on 17 Mar 2020 by Asif Newaz
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
x = rand(10,1); y = rand(1,10); colors = ['g', 'r', 'b']; colorNum = randi(length(colors)); color = colors(colorNum); colorCodes = {[0 1 0], [1 0 0], [0 0 1]}; color_correct = colorCodes{colorNum}; h = makeAPlot(x,y,color); poltHandle = get(h); plotColor = poltHandle(1).Color; plotX = poltHandle(1).XData; plotY = poltHandle(1).YData; assert(isequal(plotColor,color_correct)) assert(isequal(plotX',x)) assert(isequal(plotY,y))

h = Line with properties: Color: [1 0 0] LineStyle: '-' LineWidth: 0.5000 Marker: 'none' MarkerSize: 6 MarkerFaceColor: 'none' XData: [0.6165 0.1003 0.0830 0.3612 0.4665 0.6096 0.6087 0.5639 0.3179 0.6531] YData: [0.2928 0.1922 0.4512 0.9883 0.7854 0.8592 0.4367 0.3086 0.2329 0.5226] ZData: [1×0 double] Show all properties

`  `

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!