Unrecognized function or variable 'a'.

1 回表示 (過去 30 日間)
Dao
Dao 2023 年 5 月 23 日
回答済み: Selena Mastrodonato 2023 年 5 月 23 日
My teacher assigned me a task to find the first and second derivative of f(x,y,z) and given f(x,y,z) = (a*x+b*y+c*z)*asin(x*y*z). Here is my work:
syms x y z;
f = (a*x + b*y + c*z) * (asin(x*y*z));
disp('Dao ham rieng cap 1 cua f theo x:')
diff(f,x);
Why do I get this error? Can someone explain please

回答 (2 件)

Dyuman Joshi
Dyuman Joshi 2023 年 5 月 23 日
You get an error because you have undefined variables in your code, that are a, b and c.
If they have any numeric value, then assign the values. Otherwise, define them as symbolic variables
syms x y z a b c
f = (a*x + b*y + c*z) * (asin(x*y*z));
disp('Dao ham rieng cap 1 cua f theo x:')
Dao ham rieng cap 1 cua f theo x:
diff(f,x)
ans = 

Selena Mastrodonato
Selena Mastrodonato 2023 年 5 月 23 日
Hi Dao,
you have to add a, b and c in syms command:
syms x y z a b c
f = (a*x + b*y + c*z) * (asin(x*y*z));
disp('Dao ham rieng cap 1 cua f theo x:')
Dao ham rieng cap 1 cua f theo x:
diff(f,x)
ans = 

カテゴリ

Help Center および File ExchangeAssumptions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by