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
Impossibile completare l'azione a causa delle modifiche apportate alla pagina. Ricarica la pagina per vedere lo stato aggiornato.
Translated by
Seleziona un sito web
Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .
Puoi anche selezionare un sito web dal seguente elenco:
Come ottenere le migliori prestazioni del sito
Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.