Effacer les filtres
Effacer les filtres

Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

formula implementation using det

1 vue (au cours des 30 derniers jours)
x
x le 28 Août 2011
Clôturé : MATLAB Answer Bot le 20 Août 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 commentaire
Oleg Komarov
Oleg Komarov le 28 Août 2011
Please format the code: http://www.mathworks.com/matlabcentral/answers/13205-tutorial-how-to-format-your-question-with-markup#answer_18099

Réponses (1)

Walter Roberson
Walter Roberson le 29 Août 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);

Cette question est clôturée.

Community Treasure Hunt

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

Start Hunting!

Translated by