3 views (last 30 days)

Show older comments

I want to implement above mathematical functions, how can do this???

Ameer Hamza
on 12 Apr 2020

Edited: Ameer Hamza
on 12 Apr 2020

For first equation

V % your 3D matrix

V_mean = mean(v, 1:ndims(V))

v = sum((V-V_mean).^2, 1:ndims(V))

The second equation

V % your 3D matrix

s = -sum(V.^2.*log(1+V.^2), 1:ndims(V))

Thiago Henrique Gomes Lobato
on 12 Apr 2020

Considering that nu is a function of x,y,z and you described it as a 3-dimensional matrix in your code you could implement then as follows:

nu = rand(10,10,10); % substitute by your nu

F1 = sum( (nu(:)-mean(nu(:))).^2);

F2 = -sum( ( nu(:).^2.*log(1+nu(:).^2)));

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

Start Hunting!