Check for incorrect argument data type or missing argument in call to function 'diff'.
6 次查看(过去 30 天)
显示 更早的评论
>> 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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/632115/image.png)
Have I input it correctly or am i missing something?
1 个评论
Jan
2021-5-27
Do you want a symbolical or numerical output? Why do you use inline? This is outdated for over 10 years.
回答(2 个)
Kunal Kandhari
2021-6-1
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.
0 个评论
Mahesh Taparia
2021-6-3
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!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Function Creation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!