Wickerman All American 2404 Posts user info edit post |
I want to rotate a 2d array by a certain angle. I can use teh rot90 command and rate 90 degrees but I'm not able to figure out a way to rotate it by like say 60degrees.. 12/3/2008 8:49:37 AM |
Aficionado Suspended 22518 Posts user info edit post |
multiply the rot90 command by 2/3 to get your 60° rotation 12/3/2008 9:40:59 AM |
jethromoore All American 2529 Posts user info edit post |
You realize that rot90 physically rotates the matrix? Like if you had written it on paper and then rotated the paper 90 degrees.
|1 2 3| |4 5 6|
it would return
|3 6| |2 5| |1 4|
In short there is no such thing as rotating it anything other than a factor of 90deg.
So I assume you are rotating a vector? If so then you multiply by the rotation matrix IIRC. 12/3/2008 10:01:45 AM |
Wickerman All American 2404 Posts user info edit post |
^ yea thats what I meant..how do I get teh IIRC thing? 12/3/2008 10:51:50 AM |
ScHpEnXeL Suspended 32613 Posts user info edit post |
you know iirc = if i remember correctly, right? 12/3/2008 11:00:26 AM |
0EPII1 All American 42541 Posts user info edit post |
12/3/2008 11:04:42 AM |
jethromoore All American 2529 Posts user info edit post |
Yea I'm sure googling "rotation matrix iirc" didn't help you much so:
http://mathworld.wolfram.com/RotationMatrix.html 12/3/2008 11:08:05 AM |
moron All American 34142 Posts user info edit post |
Quote : | "yea thats what I meant..how do I get teh IIRCrotation matrix thing?" |
use math?
Looks like matlab has this built in though... nice
[Edited on December 3, 2008 at 11:47 AM. Reason : ]12/3/2008 11:45:55 AM |
darkone (\/) (;,,,;) (\/) 11610 Posts user info edit post |
If you have the image processing tool box the imrotate command should do what you want.
Quote : | "B = imrotate(A,angle) rotates image A by angle degrees in a counterclockwise direction around its center point. To rotate the image clockwise, specify a negative value for angle. imrotate makes the output image B large enough to contain the entire rotated image. imrotate uses nearest neighbor interpolation, setting the values of pixels in B that are outside the rotated image to 0 (zero)." |
12/3/2008 12:00:51 PM |
BigMan157 no u 103354 Posts user info edit post |
robotics toolbox has them too
rotx, roty, and rotz 12/3/2008 12:11:26 PM |
Wickerman All American 2404 Posts user info edit post |
I have another question.. does anyone here know how to solve second order differential equations in Matlab? I need to solve three 2nd order equations.. I've broken them down to six 1st order equations and solved them.. m not sure if my solution is right.. 1/14/2009 11:14:49 AM |
darkone (\/) (;,,,;) (\/) 11610 Posts user info edit post |
^ Look under MATLAB help in the following section: MATLAB -> Mathematics -> Differential Equations -> *
All the functions available to you, their syntax, and how to apply them to your particular types of equations is all spelled out in great detail. 1/14/2009 12:38:16 PM |