Question

In: Computer Science

Using matlab I need to create five random circles with grid x and y (100,100). Also...

Using matlab I need to create five random circles with grid x and y (100,100). Also create 10 different colors

x(1:100) and y (1:100)

Solutions

Expert Solution


clc,clear,close all
%
% set limits on radii and centers
min_x = 10; max_x = 90; min_y = 10; max_y = 90;
min_radius = 2; max_radius = 10;
%
number_of_circles = 5;
colors = {'r','b','g','k','m'}; % five different colors (number_of_circles)
%
% generate random centers and radii
x_center = (max_x-min_x).*rand(number_of_circles,1) + min_x;
y_center = (max_y-min_y).*rand(number_of_circles,1) + min_y;
radius = (max_radius-min_radius).*rand(number_of_circles,1) + min_radius;
%
% define the angle 0 to 2*pi (complete revolution)
theta = linspace(0,2*pi,100);
%
% compute the coordinates x and y and plot
for i=1:numel(x_center)
x = radius(i) * cos(theta) + x_center(i);
y = radius(i) * sin(theta) + y_center(i);
%
plot(x,y,'color',colors{i})
hold on
end
xlim([1 100]),ylim([1 100]),grid on,xlabel('x'),ylabel('y')

------------------------------------------------------------------------------
COMMENT DOWN FOR ANY QUERY RELATED TO THIS ANSWER,

IF YOU'RE SATISFIED, GIVE A THUMBS UP
~yc~


Related Solutions

10. Suppose that X, Y and Z are normally distributed where X ≈ N(100,100), Y ≈...
10. Suppose that X, Y and Z are normally distributed where X ≈ N(100,100), Y ≈ N(400, 400) and Z ≈ N(64,64). Let W = X + Y + Z. a) Describe the distribution of W, give a name and parameters E(W) and Var(W). b) Use Excel or R to generate 200 random values for X, Y and Z. Add these to obtain 200 values for W. Create a histogram for W. In Excel use the NORMINV(rand(),mean, sd) function. c)...
Suppose that X, Y and Z are normally distributed where X ≈ N(100,100), Y ≈ N(400,...
Suppose that X, Y and Z are normally distributed where X ≈ N(100,100), Y ≈ N(400, 400) and Z ≈ N(64,64). Let W = X + Y + Z. a) Describe the distribution of W, give a name and parameters E(W) and Var(W). b) Use Excel or R to generate 200 random values for X, Y and Z. Add these to obtain 200 values for W. Create a histogram for W. In Excel use the NORMINV(rand(),mean, sd) function. c) Estimate...
Using matlab Find x and y that solve the following system: ln(x 2 + y) =...
Using matlab Find x and y that solve the following system: ln(x 2 + y) = 1 − y , xy = − √ x
I am learning Matlab. I have a math formula such as A(x , y)= (x+1) /...
I am learning Matlab. I have a math formula such as A(x , y)= (x+1) / (y+1), and n=6 How can I write down the for loop in Matlab to express 1 <= x and y < = n? Thanks
(In Matlab) Create a base class named Point that has the properties for x and y...
(In Matlab) Create a base class named Point that has the properties for x and y coordinates. From this class derive a class named Circle having an additional property named radius. For this derived class, the x and y properties represent the center coordinates of a circle. The methods of the base class should consist of a constructor, an area function that returns 0, and a distance function that returns the distance between two points. The derived class should have...
Matlab Create/write a function that takes an input of x and y data, and a string...
Matlab Create/write a function that takes an input of x and y data, and a string (either linear? or quadratic), sets up a linear system of equations (Ax = b), and solves and plots the model.
Create a hot and cold game in Matlab to find a point in an (X,Y) 2D...
Create a hot and cold game in Matlab to find a point in an (X,Y) 2D coordinate plane. The user answers two inputs: x=Input('x') y=Input('y'). THE INPUTS WILL ONLY BE INTEGERS FROM 0 TO 100. This means no negative numbers. You write the program so the computer plays the game. The computer must play the game (comparing distances only) and give the same point as the user inputs. To keep it simple the code will check distances until distance =...
Hello, I need the Matlab code of the Fourier Transform without using the Matlab functions fft...
Hello, I need the Matlab code of the Fourier Transform without using the Matlab functions fft and dft. Applied to discrete signals. If you can with an example.Thank you!!
Using MATLAB, Create five scripts for 5 3D polts with different views
Using MATLAB, Create five scripts for 5 3D polts with different views
using matlab, compute and plot y [n] = x [n]* h [n], where a. x [n]...
using matlab, compute and plot y [n] = x [n]* h [n], where a. x [n] = h [n] = a^n (0 <=n <=40) & a = 0.5 b. x [n] = cos [n]; h [n] = u [n]; n = 0:4:360 c. x [n] = sin [n] ; h [n] = a^n; n:4:360; a = 0.9
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT