Matlab - 将虚线更改为实线

时间:2012-10-17 19:03:30

标签: matlab plot line dotted-line

如何在剧情中更改虚线?我知道它是这样做的plot(x, y, '-')但是即使我把它放在那里我也会得到虚线

naj_cas = 0;
uhol_deg = -5;
v = 20;
g = 9.80665;

while uhol_deg < 85
    uhol_deg = uhol_deg + 10;
    uhol_rad = degtorad(uhol_deg);

    for t = 0:.1:5
        x = v * t * cos(uhol_rad);
        y = v * t * sin(uhol_rad) - 0.5 * g * t^2;
        axis([0 50 0 25])
        subplot(211);
        plot(x, y)
        hold on
    end
end

1 个答案:

答案 0 :(得分:2)

您正在绘制单个点而不是线。这些显示为点,线属性的任何更改都不起作用。试试这个:

t = (0:.1:5);    
while uhol_deg < 85
    uhol_deg = uhol_deg + 10;
    uhol_rad = pi*uhol_deg/180;

    x = v * t * cos(uhol_rad);
    y = v * t * sin(uhol_rad) - 0.5 * g * t.^2;
    axis([0 50 0 25])
    plot(x, y)
    hold on
end