matlab程序错误,[x]=meshgrid(0:1:8)q=0;for j=1:5s=1;for i=1:3s(j)=[s.*gaussmf(x(:,i),[j 4])];ends(j)p=0 ;for i=1:3p=p+s(j); end y=(q+s(j)./p)';end In an assignment A(I) = B,the number of elements in B andI must be the same.应该是s(j)那出错
来源:学生作业帮助网 编辑:六六作业网 时间:2025/02/07 16:00:15
matlab程序错误,[x]=meshgrid(0:1:8)q=0;for j=1:5s=1;for i=1:3s(j)=[s.*gaussmf(x(:,i),[j 4])];ends(j)p=0 ;for i=1:3p=p+s(j); end y=(q+s(j)./p)';end In an assignment A(I) = B,the number of elements in B andI must be the same.应该是s(j)那出错
matlab程序错误,
[x]=meshgrid(0:1:8)
q=0;
for j=1:5
s=1;
for i=1:3
s(j)=[s.*gaussmf(x(:,i),[j 4])];
end
s(j)
p=0 ;
for i=1:3
p=p+s(j);
end
y=(q+s(j)./p)';
end
In an assignment A(I) = B,the number of elements in B and
I must be the same.
应该是s(j)那出错了,但是我想分别求出j=1,2,3,4,5时的s,该怎么写呢,
matlab程序错误,[x]=meshgrid(0:1:8)q=0;for j=1:5s=1;for i=1:3s(j)=[s.*gaussmf(x(:,i),[j 4])];ends(j)p=0 ;for i=1:3p=p+s(j); end y=(q+s(j)./p)';end In an assignment A(I) = B,the number of elements in B andI must be the same.应该是s(j)那出错
你表达式s(j)的地方有问题,乘出来应该是一个列向量,你赋值成一个行向量的形式了.
[x]=meshgrid(0:1:8);
q=0;
for j=1:1%5
s=ones(9,1);
for i=1:3
s(:,j)=[s.*gaussmf(x(:,i),[j 4])];%9行1列
end
s(:,j)
p=0 ;
for i=1:3
p=p+s(:,j);
end
y=(q+s(:,j)./p)';
end