phi_test - phip = phi_sensitivity(Wp,s phim =...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
function [] = phi_test(W, s,h ) %PHI_TEST Summary of this function goes here % Detailed explanation goes here [i j] = find(W); n = randi(length(i)); i = i(n); j = j(n); % i, j are indices of a weight to check; % h is a step size (e.g. h = 1e4) Wp = W; Wp(i,j) = Wp(i,j) + h; Wm = W; Wm(i,j) = Wm(i,j) - h; [phi,Ws,ss] = phi_sensitivity (W,s);
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: phip = phi_sensitivity (Wp,s); phim = phi_sensitivity (Wm,s); format longENG phip phim Ws_ij_est = (phip-phim)/2/h Ws(i,j) abs(Ws_ij_est - Ws(i,j))/abs(Ws(i,j)) %fprintf( 'Ws(i,j) = %g; check vs fd = %gnn', Ws(i,j), abs(Ws_ij_est - Ws(i,j))/abs(Ws(i,j))); end...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online