How to implement mathematical functions
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I want to implement above mathematical functions, how can do this???
2 comentarios
John D'Errico
el 12 de Abr. de 2020
Editada: John D'Errico
el 12 de Abr. de 2020
Yours is the kind of question that almost never gets a satisfactory answer on a forum. Why not? Its kind of a vague question, where it seems clear the asker does not really understand MATLAB that well. To a large extent, the answer needs to be to learn to use MATLAB.
We don't know what you have in the form of a function for nu. We don't know what your data looks like, and in what form it is stored. Sadly, we know absolutely nothing about what YOU know about MATLAB, partially because we see no effort made by you to try to solve your problem. When I see a fragment of MATLAB code written by someone, I can then judge their relative level of skill and knowledge about MATLAB. When I see no code at all, then I must assume this is a complete novice asking the question.
It would help if you gave a very clear, limited example, where we see in what form your data is stored, and where we see the answer you would have expected from that sample problem.
So what happens is nobody really knows what you are asking, but they can expect to enter into that conversation means someone would need to enter into a rather lengthy dialogue where they figure out what you have, and then try to teach you enough MATLAB to solve the problem. In the end, most people just glance at your question and then move on. So questions like this one tend to die unanswered, or they get approximate answers where people try to guess what you have.
Respuestas (2)
Ameer Hamza
el 12 de Abr. de 2020
Editada: Ameer Hamza
el 12 de Abr. de 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
el 12 de Abr. de 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)));
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!