Plot of mass using different densities
2 ビュー (過去 30 日間)
古いコメントを表示
Kenneth Bisgaard Cristensen
2021 年 3 月 23 日
コメント済み: Kenneth Bisgaard Cristensen
2021 年 3 月 23 日
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!