Check for incorrect argument data type or missing argument in call to function 'diff'.

>> f
f =
Inline function:
f(x) = ((x+2)^(2/3))(3*x^2 -2)^3)
>> diff(f,x)
Check for incorrect argument data type or missing argument in call to function 'diff'.
Find the derivative of the function: . This is the intended equation.
Have I input it correctly or am i missing something?

댓글 수: 1

Do you want a symbolical or numerical output? Why do you use inline? This is outdated for over 10 years.

댓글을 달려면 로그인하십시오.

답변 (2개)

The correct piece of code will be:
f = inline('((x+2)^(2/3)*((3*x^2)-2)^3)','x')
ans = f(1)
matlab will internally convert it to:
f =
Inline function:
f(x) = ((x+2)^(2/3))*(3*x^2 -2)^3)
You can refer:
Althrough inline will be removed in a future release. Use anonymous functions instead.
Hi
It seems you are finding derivative of a function of x. If you don't have the value of x, then you can go by symbolic approach. For example, consider the code below:
syms x
y = ((x+2)^(2/3))*(3*x^2 -2)^3;
yDerivative = diff(y);
If you have the sample values of x, then use last 2 lines of code. For more information, you can have a look at the documentation of diff function here.
Hope it will help!

카테고리

도움말 센터File Exchange에서 Function Creation에 대해 자세히 알아보기

제품

릴리스

R2021a

태그

질문:

2021년 5월 27일

답변:

2021년 6월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by