需要编一段程序,考虑到角度范围,不能用atan(),只能用atan2()。atan2()中的两个参数需要用字母表示,每次运算时候给(y,x)赋值,但是报错。
***atan可以计算数字参数:
>> y=1;
>> x=-1;
>> atan(y/x)
ans =
-0.7854
***atan2也可以计算数字参数:
>>atan2(1,-1)
ans =
2.3562
***atan可以计算字母参数:
>> syms y
>> syms x
>> atan(y/x)
ans =
atan(y/x)
***但是atan2却不能计算字幕参数么?
>> syms y
>> syms x
>> atan2(y,x)
Undefined function 'atan2' for input arguments of type 'sym'.
我看matlab的help里,例子也都是具体的数字,没有字母表示的例子。
问题出在哪里?我要想实现atan(y/x)结果那样的形式,该如何实现呢?