如何去除 MatLab 中绘制区域之间的分界线?
Posted
技术标签:
【中文标题】如何去除 MatLab 中绘制区域之间的分界线?【英文标题】:How to remove the dividing lines between plotted areas in MatLab? 【发布时间】:2018-07-13 14:42:44 【问题描述】:这是我打算制作的图表: flight envelope
按照我的编码方式,它由 7 条不同的曲线/线组成,绘制在同一张图中。因此,当我使用area
函数时,不仅每个区域的颜色不同(我用set (ai, 'Facecolor', [x y z])
函数“解决”了这个问题),而且它还在每个区域之间创建了一条分界线。我想知道如何删除这些行
function plot_flight_envelope (aviao, const)
W = aviao.MTOW;
S = aviao.sA;
Cl_max = aviao.CL_max_asa;
b = aviao.bA;
rho = const.rho;
g = const.g;
a = 0.0820586;
%evelope de manobra
n = 0:0.001:2.5;
n1 = 0:-0.001:-1.25;
Vs = sqrt((2 * W)/(rho * S * Cl_max)); %formula
Va = Vs * sqrt(2.5); %Va == x quando y == n_max(2.5)
Vc = 2.4 * sqrt(W/S); %FAR 23.335?
Vd = 1.4 * Vc; %FAR 23.335
hold on
plot ((Vs * sqrt(n)), n, 'b') %plota parabola positiva
n = 1:0.001:2.5; %
a1 = area ((Vs * sqrt(n)), n) %
plot (( Vs * sqrt(-1 * n1)), n1, 'b') %plota parabola negativa
n1 = -1:-0.001:-1.25; %
a2 = area (( Vs * sqrt(-1 * n1)), n1) %
a3 = area ([Va, Vc], ones(1,2) *(2.5)) %plota linhas positivas
plot ([Va, Vc], ones(1,2) *(2.5), 'b')
a4 = area ([Vc, Vd], [2.5, 2]) %
plot ([Vc, Vd], [2.5, 2], 'b')
a5 = area ([Vd, Vd], [0, 2]) %
plot ([Vd, Vd], [0, 2], 'b')
a6 = area ([(Vs * sqrt(1.25)), Vc], -1 * [1.25, 1.25]) %plota linhas negativas
plot ([(Vs * sqrt(1.25)), Vc], -1 * [1.25, 1.25], 'b')
a7 = area ([Vc, Vd], -1 * [1.25, 0]) %
plot ([Vc, Vd], -1 * [1.25, 0], 'b')
%envelope de rajada
Uc = 15.24; %FAR 23.333
Vc2 = 0:0.01:Vc;
Ud = 7.62; %FAR 23.333
Vd2 = 0:0.01:Vd;
mi = 2 * (W / (S * g)) / (rho * (S / b) * a); %formula
K = (0.88 * mi) / (5.3 + mi); %formula
ncp = calcula_n (const, Uc, Vc2, +1, K, W, S);
ncn = calcula_n (const, Uc, Vc2, -1, K, W, S);
ndp = calcula_n (const, Ud, Vd2, +1, K, W, S);
ndn = calcula_n (const, Ud, Vd2, -1, K, W, S);
plot (Vc2, ncp, 'r')
plot (Vc2, ncn, 'r')
plot (Vd2, ndp, 'r')
plot (Vd2, ndn, 'r')
plot ([max(Vc2), max(Vd2)], [max(ncp), max(ndp)], 'r')
plot ([max(Vc2), max(Vd2)], [min(ncn), min(ndn)], 'r')
set(a1,'FaceColor',[0.75 0.75 0]);
set(a2,'FaceColor',[0.75 0.75 0]);
set(a3,'FaceColor',[0.75 0.75 0]);
set(a4,'FaceColor',[0.75 0.75 0]);
set(a5,'FaceColor',[0.75 0.75 0]);
set(a6,'FaceColor',[0.75 0.75 0]);
set(a7,'FaceColor',[0.75 0.75 0]);
function n = calcula_n (const, U, V, coef, K, W, S)
n = 1 + (coef * (rho * V * a * K * U) / (2 * W / S));
end
grid
hold off
end
【问题讨论】:
【参考方案1】:您可以设置区域的边缘颜色:
set (ai, 'Edgecolor', [x y z])
【讨论】:
以上是关于如何去除 MatLab 中绘制区域之间的分界线?的主要内容,如果未能解决你的问题,请参考以下文章
如何使用MATLAB绘制ggplot风格图片(散点图及折线图)
如何使用MATLAB绘制ggplot风格图片(散点图及折线图)