Rotation of Matrix Errors

So I am trying to rotate an output of a matrix multiplication problem in spherical coordinates. I need to rotate my vector u by +45 and -60 degrees and plot them to show the original and rotated vector positions. My code is as follows so far:
clear all
clc
v=[1; 0; 0]
theta=0
rm=[cos(theta) sin(theta) 0; -sin(theta) cos(theta) 0; 0 0 1]
u=rm*v
a1=rotate(u,[1 0 0],45)
a2=rotate(u,[1 0 0],-60)
plot3(u,a1,a2);
-----> when I run my program, Matlab gives me an error of having too many output arguments but I do not understand why or how to fix this issue? I have also tried using the rotate(H,[THETA PHI],ALPHA) function but that tells me that I the number of children isn't of the same axes. I do now know where I am going wrong. Any help would be awesome! I am very new to using Matlab.

Answers (1)

Azzi Abdelmalek
Azzi Abdelmalek on 24 Feb 2013
Edited: Azzi Abdelmalek on 24 Feb 2013
rotate(u,[1 0 0],45)
u should be a handle of your plot
h=plot(u)
rotate(h,[1 0 0],45)

Asked:

on 24 Feb 2013

Community Treasure Hunt

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

Start Hunting!