Borrar filtros
Borrar filtros

Plot of mass using different densities

3 visualizaciones (últimos 30 días)
Kenneth Bisgaard Cristensen
Kenneth Bisgaard Cristensen el 23 de Mzo. de 2021
Comentada: Kenneth Bisgaard Cristensen el 23 de Mzo. de 2021
Hi MATLAB Community,
I am trying to make a graph in MATLAB, to look like the grap below. but not sure how to make the plot. ny advice would be appriated.
%Mass of different size balls
de= [.0015, .0020, .0050]; %Density [kg/cm^3]
b=[100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1200, 1500, 2000]; %Ball Size[µm]
r=b/20000; %Radius of ball [cm]
m=de*3/4*pi*r^3; % %Mass [kg]
plot(m,r);
title('3 Different Size of Balls');
legend('1500 kg/m^3, 2500 kg/m^3, 5000 kg/m^3')
xlabel('Ball Mass [kg]');
ylabel('Ball Size [μm]');
grid on
grid minor

Respuesta aceptada

DGM
DGM el 23 de Mzo. de 2021
Something like this
%Mass of different size balls
de= [.0015, .0020, .0050]; %Density [kg/cm^3]
b=[100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1200, 1500, 2000]; %Ball Size[µm]
r=b/20000; %Radius of ball [cm]
% use element-wise exponentiation
% Kronecker product of two orthogonal vectors is a 2D array
% which is what we want, so transpose the density vector
m=kron(de',3/4*pi*r.^3); %Mass [kg]
plot(r,m);
title('3 Different Size of Balls');
% the legend strings need to be separate arguments, not one
legend('1500 kg/m^3', '2500 kg/m^3', '5000 kg/m^3','location','northwest')
ylabel('Ball Mass [kg]');
xlabel('Ball Radius [cm]'); %needed to use the right units
grid on
grid minor
That's getting there.
  1 comentario
Kenneth Bisgaard Cristensen
Kenneth Bisgaard Cristensen el 23 de Mzo. de 2021
Thanks, the m=kron(x) was exactly what I was looking for. Relly appricate the help.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Particle & Nuclear Physics en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by