查看完整版本 : [MATLAB基础] 求助:如何写这个数学表达式
zhouwen19870115
2009-04-24, 13:21
各位高手,小弟谢谢指点!谢谢!1693
mathjiang
2009-04-24, 17:44
设U,Z,V为三个矩阵,试一下下面语句:
[M N]=size(U);
P=size(Z,1);
for i=1:M
a(i)=sum(U(i,:).^m);
for j=1:P
for k=1:N
b(k)=U(i,k)^m*(Z(j,k)-V(j,i))^2;
c=sum(a);
end
F(i,j)=c/a(i);
end
end
mathjiang
2009-04-24, 18:05
function F=findF(u,z,v,m)
%u,z,v是矩阵,m是一个实数.
[m1 n1]=size(u);
[m2 n2]=size(z);
[m3 n3]=size(v);
if n1~=n2
error('number of columns of u must equal to that of z')
elseif m1~=n3
error('number of rows of u must equal to that of columns of v')
else
if m2~=m3
error('number of rows of z must equal to that of v')
end
end
for i=1:m1
a(i)=sum(u(i,:).^m);
for j=1:m2
for k=1:n1
b(k)=u(i,k)^m*(z(j,k)-v(j,i))^2;
c=sum(a);
end
F(i,j)=c/a(i);
end
end
vBulletin® v3.8.3,版权所有 ©2000-2025,Jelsoft Enterprises Ltd.