Plotting lines from random number generators
Afficher commentaires plus anciens
Hi,
I need help with visualizing a set of data that i generated in MATLAB to represent discrete fractures. I made use of random number generators to get the fracture centers and also have other vectors representing the orientation(angle i want the line to be tilted through), length of the line through the center point and width of the line. I've had a hard time getting to visualize this data in MATLAB.. Can anyone please help? My code sample is attached
k= 3.4;
Density = 1.5;
Mu = 0.;
Sigma = 0.7;
Length = 75;
Lambda = 2*Density*Length;
N = floor(Lambda);
Center = poissrnd(Lambda,2,N);
Radii = lognrnd(Mu,Sigma, N, 1);
Aperture = 0.004*sqrt(Radii);
d = rand(N,1);
f = exp(k) - (2* d.*sinh(k));
Angle = acos(log(f)/k);
Newradii = 2500*Aperture; % To aid visualization of fractures
x = (Center(1,:)- Lambda)';
y = (Center(2,:)- Lambda)';
% section for visualization..
for i = 1: N
plot(x(i), y(i),'go' , 'MarkerSize',Newradii(i))
hold all
end
How do i inculcate orientations into the plot generated? and this present code plots the points as circles.. i want them as straight lines.
Thanks.
Toyin
Réponses (1)
Honglei Chen
le 27 Fév 2012
I don't quite understand what you mean by plotting them as straight lines, do you want to connect them to the center? If so, just do
plot([Center(1,i) x(i)],[Center(2,i) y(i)]);
As to the direction, you can take a look at the quiver function
doc quiver
Catégories
En savoir plus sur Vector Fields dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!