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.
Thank you sir for your answers. Actually I need the analytical derivative of the function and the value of it at each point in the defined range. i.e. diff (F,X)=4*3^(1/2)*X; is giving me the analytical derivative of the function. After finding this I also need to find its value at each point of X( i.e., for X=(-1:2/511:+1). Similarly the others.
For clarification, the numerical and symbolic calculations are fairly similar code wise. Walter has provided the symbolic gradients (as requested), while Youssef has provided the numerical ones. One correction is that dX = matlabFunction(diff(F,x)) is only a function of x, which is why it generates an error when calling dX(x,y).
To go in a bit more detail on Walter's suggested solution:
clear
% Define Mesh
[ X,Y] = meshgrid(-1:2/10:1,-1:2/10:1); % Using 2/10 as spacing
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.
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
No se puede completar la acción debido a los cambios realizados en la página. Vuelva a cargar la página para ver el estado actualizado.
Translated by
Seleccione un país/idioma
Seleccione un país/idioma para obtener contenido traducido, si está disponible, y ver eventos y ofertas de productos y servicios locales. Según su ubicación geográfica, recomendamos que seleccione: .
También puede seleccionar uno de estos países/idiomas:
Cómo obtener el mejor rendimiento
Seleccione China (en idioma chino o inglés) para obtener el mejor rendimiento. Los sitios web de otros países no están optimizados para ser accedidos desde su ubicación geográfica.