【error】Undefined function or method ‘rad2deg’ for input arguments of type ‘double’.

Reason: when the function isn’t on the MATLAB path or in pwd.

1. make sure that you are able to find the function using:

>> which rad2deg
‘rad2deg’ not found.

The return means It is not on the MATLAB path or in PWD. That is often unhelpful in this case – it tells you Matlab can’t find the file, which you knew already.

2.  make sure that the file that matlab is finding (use which) requires the same type as the first argument you are actually passing.

Basically, Matlab looks for files in:

  1. The current directory (pwd);
  2. Directly in a directory on the path (to see the path, type path at the command line)
  3. In a directory named @(whatever the class of the first argument is) that is in any directory above.

RAD2DEG

Radians To Degrees Conversion Function .

Converts the argument array from radians to degrees. The general syntax for its use is y = rad2deg(x)
Note that the output type will be the same as the input type, and that complex arguments are allowed. The output is not wrapped to [0,360).

Some known conversion factors
--> rad2deg(1) % one radian is about 57 degrees
ans =
57.2958
--> rad2deg(pi/4) % should be 45 degrees
ans =
45
--> rad2deg(2*pi) % Note that this is 360 not 0 degrees
ans =
360

f0 = 60;         %frequency (Hz)
w0 = f0*pi/180;  %natural frequency (rad)

The conversion factor is not difficult, but it can be a workflow distraction nonetheless.

radians(180)
ans =
       3.1416

degrees(pi/3)
ans =
           60
  • deg = rad./(pi/180);
  • ad = pi.*deg./180 ;
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

生活在西班牙

自己动手丰衣足食

BlueAsteroid

Just another WordPress.com site

Jing's Blog

Just another WordPress.com site

Start from here......

我的心情魔方

天才遠私廚

希望能做一個分享各種資訊的好地方

语义噪声

西瓜大丸子汤的博客

笑对人生,傲立寰宇

Just another WordPress.com site

Where On Earth Is Waldo?

A Project By Melanie Coles

the Serious Computer Vision Blog

A blog about computer vision and serious stuff

Cauthy's Blog

paper review...

Cornell Computer Vision Seminar Blog

Blog for CS 7670 - Special Topics in Computer Vision

datarazzi

Life through nerd-colored glasses

Luciana Haill

Brainwaves Augmenting Consciousness

槑烎

1,2,∞

Dr Paul Tennent

and the university of nottingham

turn off the lights, please

A bunch of random, thinned and stateless thoughts around the Web

%d bloggers like this: