小编jon*_*jon的帖子

Matlab与Mathematica,特征向量?

function H = calcHyperlinkMatrix(M)
    [r c] = size(M);
    H = zeros(r,c);
    for i=1:r,
        for j=1:c,
            if (M(j,i) == 1)
                colsum = sum(M,2);
                H(i,j) = 1 / colsum(j);
            end;
        end;
    end;
    H     


function V = pageRank(M)
    [V D] = eigs(M,1);
    V

function R = google(links)
    R = pageRank(calcHyperlinkMatrix(links));
    R

M=[[0 1 1 0 0 0 0 0];[0 0 0 1 0 0 0 0];[0 1 0 0 1 0 0 0];[0 1 0 0 1 1 0 0];
    [0 0 0 …
Run Code Online (Sandbox Code Playgroud)

matlab wolfram-mathematica

2
推荐指数
1
解决办法
2504
查看次数

Matlab中的Newton Raphsons方法?

Newtons-Raphsons方法很容易在Mathematica中实现,但在Matlab中似乎有点困难.如果我可以将函数传递给函数以及如何将派生函数用作函数,我不会得到.

newtonRaphson[f_, n_, guess_] := 
 If[n == 0, guess, newtonRaphson[f, n - 1, guess - f[guess]/f'[guess]]]
newtonRaphsonOptimize[f_, n_, guess_] := 
 If[n == 0, guess, 
  newtonRaphsonOptimize[f, n - 1, guess - f'[guess]/f''[guess]]]
Run Code Online (Sandbox Code Playgroud)

似乎你既不能导出函数句柄也不能导出文件中定义的函数,但我可能错了.

matlab newtons-method

1
推荐指数
1
解决办法
2万
查看次数