作业帮 > 综合 > 作业

哪位高手帮我把下面这个matlab的程序转换成mathematica的啊?急用急用 感激不尽!

来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/11/18 14:13:04
哪位高手帮我把下面这个matlab的程序转换成mathematica的啊?急用急用 感激不尽!
熵值法确定权重的源程序:% 熵值法确定权重 % 确定指标层权重 clear; clc; x=[ ]; y=[] [m,n]=size(x); for i=1:n y(:,i)=x(:,i)/sum([x(:,i)]) % 原始矩阵归一化 end for l=1:n s(1,l)=0; for j=1:m p(1,l)=y(j,l)*log(y(j,l)) s(1,l)=s(1,l)+p(1,l) end end k=(log(m))^(-1) e=-k*s h=ones(1,n)-e w=h/sum(h) % 指标权重值 sum(w) % 计算综合评价值 g=y*w'
熵值法确定权重的源程序:
% 熵值法确定权重
% 确定指标层权重
clear;
clc;
x=[ ];
y=[] [m,n]=size(x);
for i=1:n
y(:,i)=x(:,i)/sum([x(:,i)]) % 原始矩阵归一化
end
for l=1:n
s(1,l)=0;
for j=1:m
p(1,l)=y(j,l)*log(y(j,l))
s(1,l)=s(1,l)+p(1,l)
end
end
k=(log(m))^(-1)
e=-k*s
h=ones(1,n)-e
w=h/sum(h) % 指标权重值
sum(w)
% 计算综合评价值
g=y*w'
哪位高手帮我把下面这个matlab的程序转换成mathematica的啊?急用急用 感激不尽!
(* MATHEMATICA 熵值法 *)
(* 注意矩阵的格式 *)
x={
{99.3600,380952974700.0000,104.8900,1.6400,9.0500,8.2800,101452980.1100,1167334984012.1600,102.1300,228127.0000,5304940.0000,29817.0000},
{92.1100,466610267000.0000,111.6500,4.3300,5.4400,8.1600,75883744.8300,861424359113.9300,94.6000,1253922.0000,8087900.0000,85194.0000},
{109.1000,305694698312.7900,110.8800,2.6900,4.1700,8.4000,457459478.2500,1179235081612.4700,110.0600,468307.0000,677090.0000,63273.0000},
{109.1000,595020144866.6500,99.3000,2.0100,4.5700,4.3000,783157007.2100,5007646096891.2900,109.2600,1993306.0000,1930440.0000,65491.0000},
{98.2200,372654923215.5300,107.1300,1.4400,8.5100,23.8000,18848868.8700,704821878325.1800,101.1000,162951.0000,62990.0000,22051.0000},
{104.6500,365675537000.0000,111.7600,2.1400,5.0200,9.3900,27417364.3700,89952506168.7600,104.3300,87487.0000,670.0000,5195.0000},
{101.2900,366895501851.6100,101.8200,1.9400,8.5100,5.5800,11549288.9200,1258455637300.0000,103.9700,309613.0000,1539200.0000,9674.0000},
{100.8500,392520087435.9700,106.2700,0.7600,9.5300,8.6500,19599155.2300,48932431697.2000,101.4400,82859.0000,305990.0000,25023.0000},
{96.3600,347542443470.0800,99.6000,1.2600,9.6900,18.0100,22939492.6400,1297226915351.5100,99.0900,29917.0000,172930.0000,15043.0000},
{97.3700,100.0000,99.6400,4.6800,16.2100,9.2600,158995068.0700,15077285740000.0000,98.4000,1688822.0000,3021080.0000,226205.0000}
};
m=Dimensions[x][[1]];
n=Dimensions[x][[2]];
y=Table[0, {i, m}, {j, n}];
(* 原始矩阵归一化 *)
For[i = 1, i