error when using diff() on trigonometric functions

Hello,
When i try to apply this in matlab:
syms x
diff(cos(x))
I get :
ans =
diff(cos(x), x)
Instead of -sin(x) as expected. The examples and help show that it should work for trig functions and I don't understand why this isn't working for me.
Is this a kind of bug? Has anyone encountered this before?
Thanks, Alex

4 件のコメント

Wayne King
Wayne King 2013 年 3 月 14 日
Can you please give which version of MATLAB you are using? Thanks
alex pabouctsidis
alex pabouctsidis 2013 年 3 月 14 日
I'm using R2012b
Jan
Jan 2013 年 3 月 14 日
Did you create a variable or function called "cos" before?
alex pabouctsidis
alex pabouctsidis 2013 年 3 月 14 日
I had a syms cos(phi) for another variable, which in hindsight was a bit dumb :P
i removed it and it works now.
thanks!

サインインしてコメントする。

回答 (0 件)

タグ

質問済み:

2013 年 3 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by