Borrar filtros
Borrar filtros

Partial Derivatives function numerical computing

2 visualizaciones (últimos 30 días)
sree chak
sree chak el 3 de Sept. de 2020
Respondida: David Hill el 3 de Sept. de 2020
So I have the following problem:
There is an equation for B(x,y,z), which I have calculated.
Let's say it's B = [3x.^2 - y.^2 5zy 3xz]
I have taken the partial derivatives as follows using the diff function (as everything is symbolic) and have calculated analytically the partial derivatives.
Gxx = diff(Bx, x)
Gxy = diff(Bx, y)
Gxz = diff(Bx, z)
etc.
What I want to do is create a separate function that will take in (x,y,z) values and spit out the numerical computing of Gxx, Gxy (since the partial derivative analytically has already been calculated).
I have been able to numerically compute using vpa and sub, but I have to put the x,y,z values into the sub function...I wanted something like:
function G = computerDerivatives(x,y,z) that will taken in x,y,z and give me the numerical computing of Gxx, Gxy.
If someone can provide guidance, that will be much appreciated.

Respuesta aceptada

David Hill
David Hill el 3 de Sept. de 2020
function [Gx,Gy,Gz] = computerDerivatives(c,Gxx,Gxy,Gxz)
x=c(1);
y=c(2);
z=c(3);
Gx=subs(Gxx);
Gy=subs(Gxy);
Gz=subs(Gxz);
end

Más respuestas (0)

Categorías

Más información sobre Numerical Integration and Differential Equations en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by