subplot random points in color

7 views (last 30 days)
anabel atah
anabel atah on 5 Jan 2020
Answered: Image Analyst on 5 Jan 2020
I have this function
function [I]= fick_diffusion(D, Cin,Cout,dist)
I = -D*((Cin-Cout)/dist)
end
I have all this parameters:
D= 2.1*10^-5
A = 30*40
Nin=20
Nout=0
dist = 40
while Nin>=10
[I] = fick_diffusion(D,Nin/A,Nout/A,dist)
Num_moving_part = -round(Nin*I*10^7)+2
Num_moving_location = randperm(Nin,Num_moving_part)
I need to find random location for the Num_moving_part when Nin and Nout are equal and there are only 20N together
and I need to subplot every move of the N and in a differnt color until in both side there are 10 N

Answers (1)

Image Analyst
Image Analyst on 5 Jan 2020
When you go to plot a marker on your plots, choose a random color:
randomColor = rand(1, 3);
hold on;
plot(x, y, '.', 'Color', randomColor, 'MarkerSize', 30);
where x and y are scalars for just one point. This will plot all spots/markers in a different random color.

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!