MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   [MATLAB基础] 求助:如何写这个数学表达式 (https://www.labfans.com/bbs/showthread.php?t=7883)

zhouwen19870115 2009-04-24 13:21

求助:如何写这个数学表达式
 
1 个附件
各位高手,小弟谢谢指点!谢谢![ATTACH]1693[/ATTACH]

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


所有时间均为北京时间。现在的时间是 11:16

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.