Plot of mass using different densities
3 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
DGM
2021-3-23
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.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!