Filter löschen
Filter löschen

Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

formula implementation using det

1 Ansicht (letzte 30 Tage)
x
x am 28 Aug. 2011
Geschlossen: MATLAB Answer Bot am 20 Aug. 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 Kommentar
Oleg Komarov
Oleg Komarov am 28 Aug. 2011
Please format the code: http://www.mathworks.com/matlabcentral/answers/13205-tutorial-how-to-format-your-question-with-markup#answer_18099

Antworten (1)

Walter Roberson
Walter Roberson am 29 Aug. 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);

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by