Plotting graph with different color points

조회 수: 2 (최근 30일)
MAYANK PANDEY
MAYANK PANDEY 2021년 6월 24일
답변: Swetha Polemoni 2021년 6월 28일
Generate 2000 random values (not just integers) for x in the interval [−35; 165] and y in the interval [−20; 80]. Out of these points randomly select two points as center. Around the first center randomly select radii for two concentric circle spaces. First radius random number between 1 to 15, and second radius value is a random number between first radii and 40.
Plot points x and y such that all the points lying inside the smaller concentric circle in green color, points lying in the second concentric circle are in red color. Repeat the same with the second center and its two concentric circles. Remaining points are plotted in yellow.

답변 (1개)

Swetha Polemoni
Swetha Polemoni 2021년 6월 28일
Hi
  • To generate a random value in a given range, "randi" Matlab function can be used.
  • Following is an answer that will help to understand how to draw a circle given centre and radii.
  • "Color" option can be used to plot in different colours

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by