MATLAB Answers

How to implement mathematical functions

3 views (last 30 days)
Mehul Jain
Mehul Jain on 12 Apr 2020
Commented: Mehul Jain on 13 Apr 2020
I want to implement above mathematical functions, how can do this???
  2 Comments
Mehul Jain
Mehul Jain on 12 Apr 2020
Ok, I will try to improve it.

Sign in to comment.

Answers (2)

Ameer Hamza
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
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)));

Community Treasure Hunt

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

Start Hunting!

Translated by