Dear All,
I am struggling with some problem in writing my code in Julia and, thus, ask for your assistance…
What i want to do: visualize a tensor (3x3 matrix) as ellipsoid
Problem: 1) not sure about which graphical framework to use, e.g., PyPlot or Makie (the latter looks very cool, but so far i did not get it)
2) how to draw an ellipsoid for my tensor (see the code below)
Here is my code so far:
function draw_ellipsoid(K::Array{Float64,2},discr=50)
F = svd(K)
U = F.U
V = F.V
a = F.S[1]
b = F.S[2]
c = F.S[3]
C = [0 0 0] #center of the ellipsoid
#Here is the line in my matlab code i can't rewrite into Julia in any meaningful way... This ellipsoid function is the one i used to utilize in Matlab (https://www.mathworks.com/help/matlab/ref/ellipsoid.html?searchHighlight=ellipsoid&s_tid=doc_srchtitle)...
[X,Y,Z] = ellipsoid(C[2],C[1],C[3],a,b,c,discr);
XX = zeros(discr+1,discr+1);
YY = zeros(discr+1,discr+1);
ZZ = zeros(discr+1,discr+1);
for k = 1:length(X), j = 1:length(X)
point = [X(k,j) Y(k,j) Z(k,j)]'
P = V * point;
XX(k,j) = P[1];
YY(k,j) = P[2];
ZZ(k,j) = P[3];
end
#Here is another question - should i do it with PyPlot or may be Makie (Makie i do not understand at all, bit saw nice figs)
surf(XX,YY,ZZ)
end
K =[ 0.070087 -0.0386396 0.00209088;
-0.0441344 0.105735 0.00012994;
-0.00553273 -0.00292807 0.0896236]
The results should look something like this:
I would greatly appreciate any help!