Plot of mass using different densities
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Kenneth Bisgaard Cristensen
il 23 Mar 2021
Commentato: Kenneth Bisgaard Cristensen
il 23 Mar 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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/559212/image.jpeg)
0 Commenti
Risposta accettata
DGM
il 23 Mar 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.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!