Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

formula implementation using det

1 visualización (últimos 30 días)
x
x el 28 de Ag. de 2011
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
clc;
close all;
clear all;
A = [1 2 5 ; 4 4 6 ; 7 8 9];
[x1 x2]=gradient(A);
disp(x1);
disp('GRADIENT IN HORIZONTAL DIRECTION');
disp(x2);
disp('GRADIENT IN VERTICAL DIRECTION');
x=x1+x2;
disp(x);
C=cov(x);
disp(C);
l=det(C);
disp(l);
title('determinant');
S=sqrtm(l);
disp(S);
title('square root');
U=2*3.14*(2.1*2.1);
F=S/U;
whether i can use this way to implement sqrt(detCi)/(2*pi*h*h)..of my formula sir? Ci-covariance matrix of any input matrix
  1 comentario
Oleg Komarov
Oleg Komarov el 28 de Ag. de 2011
Please format the code: http://www.mathworks.com/matlabcentral/answers/13205-tutorial-how-to-format-your-question-with-markup#answer_18099

Respuestas (1)

Walter Roberson
Walter Roberson el 29 de Ag. de 2011
sqrtm() is not useful here: you might as well use sqrt() .
Watch out for the determinant being negative: that would give you a complex square root.
3.14 is completely inadequate as a representation of Pi: use the constant pi instead.
It isn't clear to me from your description of the problem what gradient has to do with the question?
2.1 appears to be a "magic number" in your code. What does it have to do with the "h"? of your formula?
Why be so verbose?
h_squared = (2.1).^2;
F = sqrt(det(cov(x)) ./ (2*pi*h_squared);

La pregunta está cerrada.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by