dFdx(x, y) = 
To take the partial derivative of a function using matlab
Mostrar comentarios más antiguos
Here is a particular code. Can anyone please help me in taking the analytical (partial) derivative of the function 'F' along X (i.e., w.r.t. X) along Y (i.e., w.r.t. Y) and along the diagonal (i.e., w.r.t. X plus w.r.t. Y) using matlab command.
[X, Y]=meshgrid(-1:2/511:+1, -1:2/511:+1);
F=sqrt(3).*(2.*(X.^2+Y.^2)-1);
Thanking You!
Respuesta aceptada
Más respuestas (4)
Youssef Khmou
el 11 de Feb. de 2013
Editada: Youssef Khmou
el 11 de Feb. de 2013
hi , you can use "gradient" :
[dF_x,dF_y]=gradient(F);
subplot(1,2,1), imagesc(dF_x), title(' dF(x,y)/dx')
subplot(1,2,2), imagesc(dF_y), title(' dF(x,y)/dy')
2 comentarios
Walter Roberson
el 11 de Feb. de 2013
If you do not use the symbolic toolbox, gradient is numeric rather than analytic.
Youssef Khmou
el 11 de Feb. de 2013
Editada: Youssef Khmou
el 11 de Feb. de 2013
True, but he has two sides because his example is numerical, you answered to the theoretical side ,while i answered to the numerical one,
rapalli adarsh
el 9 de En. de 2019
syms c(x,y);
c(x,y)=input('enter cost Rs=\n');
cx=diff(c,x);
cy=diff(c,y);
s1=double(cx(80,20));
s2=double(cy(80,20));
if s1>s2 disp('fire standind stores')
else disp('fire standing stores')
end
Santhiya S
el 19 de Mzo. de 2023
0 votos
Using MATLAB, find the partial derivative with respect to ‘x’ and ‘y’ of the function f(x) = tan−1(x/y)
1 comentario
Replace your function in Walter's code:
syms f(x,y)
f(x,y) = atan(x/y)
dFdx = diff(f,x)
dFdy = diff(f,y)
Olivar Luis Eduardo
el 25 de Abr. de 2023
0 votos
Good morning, I also have the same question, I have consulted a lot on the web, but they always give answers as if the surface were symbolic, but it is numerically and the calculation of the partial derivative of a matrix of order mxn remains.
1 comentario
Sergio E. Obando
el 15 de Jun. de 2024
Editada: Sergio E. Obando
el 15 de Jun. de 2024
Please take a look at my comment above. The surface values are found by substituting/evaluating the symbolic expression at the grid points. Assuming you are using R2021b or later, you may find symmatrix useful for manipulation of matrix expressions, e.g. gradient of matrix multiplication
Categorías
Más información sobre Calculus en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!








