求解释: MATLAB Error using ==> plot Vectors must be the same le
来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/15 13:04:24
求解释: MATLAB Error using ==> plot Vectors must be the same lengths.
set(0,'defaultaxeslinestyleorder',{'-*','-o',':s','-.d'});
set(gca,'Xtick',[-10 10 130],'Xticklabel',{'-10','10','130'});
n1=300;
q=1;
b=10^(-4)/q;
E3=25/(q/b)^0.5;
A=100;
N=n1*A;
d=4;
i=0;
if d>0.5
for d=4:-0.1:0.5
i=i+1;
f=@(z)(z-d).^(3/2).*1/sqrt(2*pi).*exp(-z.^2/2);
Q(i)=quad(f,d,40);
P1(i)=Q(i)*4/3*N*E3*sqrt(b);
plot(P1,4:-0.1:0.5,'g')
end
end
hold on
if d<=0.5
for d=0.4:-0.1:0
i=i+1;
f=@(z)(z-d).^(3/2).*1/sqrt(2*pi).*exp(-z.^2/2)+3;
Q(i)=quad(f,d,40);
P2(i)=Q(i)*4/3*N*E3*sqrt(b);
plot(P2,0.4:-0.1:0,'g')
end
end
相当于分段函数
结果如下,为什么?
把plot从for循环里面拿出来,放到循环的后面,你现在每次for循环都会做一次plot,但在你的for循环结束之前,你的P1和P2根本都还没全部赋值完毕
再问: 不对啊 拿出来还是一样的结果。。。。
你可以帮我调试下 发给我正确的结果吗?
再答: 你第二段for循环前面要把i重新置成零
再问: 麻烦你帮我调试一下,再回答我好吗?
按照你讲的我试了都是不对的。。。。。
再答: % 现在这样明明是能画图的
% 都给你把错误给你指出来了,你还改不对……
set(0,'defaultaxeslinestyleorder',{'-*','-o',':s','-.d'});
set(gca,'Xtick',[-10 10 130],'Xticklabel',{'-10','10','130'});
n1=300;
q=1;
b=10^(-4)/q;
E3=25/(q/b)^0.5;
A=100;
N=n1*A;
d=4;
i=0;
if d>0.5
for d=4:-0.1:0.5
i=i+1;
f=@(z)(z-d).^(3/2).*1/sqrt(2*pi).*exp(-z.^2/2);
Q(i)=quad(f,d,40);
P1(i)=Q(i)*4/3*N*E3*sqrt(b);
end
plot(P1,4:-0.1:0.5,'g')
end
hold on
i = 0;
if d
再问: 不对啊 拿出来还是一样的结果。。。。
你可以帮我调试下 发给我正确的结果吗?
再答: 你第二段for循环前面要把i重新置成零
再问: 麻烦你帮我调试一下,再回答我好吗?
按照你讲的我试了都是不对的。。。。。
再答: % 现在这样明明是能画图的
% 都给你把错误给你指出来了,你还改不对……
set(0,'defaultaxeslinestyleorder',{'-*','-o',':s','-.d'});
set(gca,'Xtick',[-10 10 130],'Xticklabel',{'-10','10','130'});
n1=300;
q=1;
b=10^(-4)/q;
E3=25/(q/b)^0.5;
A=100;
N=n1*A;
d=4;
i=0;
if d>0.5
for d=4:-0.1:0.5
i=i+1;
f=@(z)(z-d).^(3/2).*1/sqrt(2*pi).*exp(-z.^2/2);
Q(i)=quad(f,d,40);
P1(i)=Q(i)*4/3*N*E3*sqrt(b);
end
plot(P1,4:-0.1:0.5,'g')
end
hold on
i = 0;
if d
求解释: MATLAB Error using ==> plot Vectors must be the same le
新手使用matlab出现Error using ==> plot Vectors must be the same le
关于出现 MATLAB Error using ==> plot Vectors must be the same le
Matlab Error using ==> plot Vectors must be the same lengths
matlab 提示错误是:Error using ==> plot Vectors must be the same l
求matlab高手~Error using plot Vectors must be the same lengths问
MATLAB运行错误:Error using plot Vectors must be the same lengths
matlab图画不出来,Error using plot Vectors must be the same length
MATLAB 错误?Error using ==> plot3 Vectors must be the same len
matlab plot 提示错误:Vectors must be the same lengths!
这个matlab程序显示错误?Error using ==> conv A and B must be vectors.
matlab如何解决?Error using ==> conv A and B must be vectors.