如何绘制多个图形

时间:2019-10-27 14:58:06

标签: matlab

以高度,20000m的高度绘制参数压力,声速,密度和温度的图形

1 个答案:

答案 0 :(得分:2)

使用航空航天工具箱,这似乎是对atmosisasubplot的直接使用。

Graphs showing Temperature, Speed of Sound, Pressure, and Density as a function of Height

相关的假设和度量单位在documentation中。

% MATLAB R2019a
height = [0:1000:20000];            % meters
[T, a, P, rho] = atmosisa(height);

% Plot
figure
s(1) = subplot(2,2,1)
    plot(height,T)
    ylabel('Temperature (K)')
s(2) = subplot(2,2,2)
    plot(height,a)
    ylabel('Speed of Sound (m/s)')
s(3) = subplot(2,2,3)
    plot(height,P)
    ylabel('Pressure (Pa)')
s(4) = subplot(2,2,4)
    plot(height,rho)
    ylabel('Density (kg/m^3)')

% Cosmetics
for jj = 1:4
    xlabel(s(jj),'Height (m)')      % Common label for x-axis

    ax = s(jj);
    ax.XRuler.Exponent = 0;         % Remove scientific notation 
    ax.YRuler.Exponent = 0;
end