MATLAB绘制分段函数报错,求大神解答(财富值有限请您见谅)x=0:0.01:3.2; if x>=0&x=0.4&x=0.8&x=2&x=2.8&x plotVectors must be the same lengths.

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/03 22:45:47
MATLAB绘制分段函数报错,求大神解答(财富值有限请您见谅)x=0:0.01:3.2;    if x>=0&x=0.4&x=0.8&x=2&x=2.8&x plotVectors must be the same lengths.

MATLAB绘制分段函数报错,求大神解答(财富值有限请您见谅)x=0:0.01:3.2; if x>=0&x=0.4&x=0.8&x=2&x=2.8&x plotVectors must be the same lengths.
MATLAB绘制分段函数报错,求大神解答(财富值有限请您见谅)
x=0:0.01:3.2;
if x>=0&x=0.4&x=0.8&x=2&x=2.8&x plot
Vectors must be the same lengths.

MATLAB绘制分段函数报错,求大神解答(财富值有限请您见谅)x=0:0.01:3.2; if x>=0&x=0.4&x=0.8&x=2&x=2.8&x plotVectors must be the same lengths.

for i=1:321

x(i)=(i-1)*0.01;   %%即x=0:0.01:320

    if x(i)>=0&&x(i)<=0.4 

        y(i)=1.6/(3.^0.5)-(0.64/3-x(i).^2).^0.5 

    elseif x(i)>=0.4&&x(i)<=0.8

        y(i)=(3.^0.5)*x(i);              

    elseif  x(i)>=0.8&&x(i)<=2  

        y(i)=3.2/(3.^0.5)+(0.64/3-(x(i)-1.6).^2).^0.5;                  

    elseif  x(i)>=2&&x(i)<=2.8

        y(i)=3.2*(3.^0.5)-(3.^0.5)*x(i); 

    elseif  x(i)>=2.8&&x(i)<=3.2  

        y(i)=1.6/(3.^0.5)-(0.64/3-(x(i)-3.2).^2).^0.5;

    end                               %结束语句 

end

    plot(x,y)