how do you do symbolic differentiation on function handle?

 Say if i define the following: 

 

 g = @(x) x/sqrt(x^2+1)

How do i get the derivative function for g, which i can then use to evaluate at different points?

I tried the symbolic math toolkit, and tried the following: 

 

>> syms x

>> f = x/sqrt(x^2+1)

f =

x/(x^2 + 1)^(1/2)

>> diff(f)

ans =

1/(x^2 + 1)^(1/2) - x^2/(x^2 + 1)^(3/2)

However, i cannot figure out how to turn this into a function handle/evaluate at different points. However, i prefer doing differentiation on function_handle.

Thank you very much!  

NOTE:-


Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help , Finance Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.    

nswer: 

You can use matlabFunction to convert a symbolic equation to a function. For example: 

 

syms x1 x2;
f1 = x1^2+x2^2; 
SEE COMPLETE ANSWER CLICK THE LINK 
https://matlabhelpers.com/questions/how-do-you-do-symbolic-differentiation-on-function-handle-.php

Comments

Popular posts from this blog

How to Perform LU Decomposition with Partial Pivoting in Matlab

Why Red, Green, Blue channels of image separetely are grayscaled (Matlab)?

How to MATLAB: Extract multiple parts of a matrix without using loops