% Unit 2 (MATLAB Course @ UAM)
% (c) Alexander Knebe

%===================
% rotate sine-curve
%===================
clear all
close all
clc

% sine-curve
N = 1000;
t = linspace(0,2.*pi,N);
x = sin(t);

% put into matrix
S = [t; x];

% rotation matrix
phi = 90. * pi./180;
R   = [cos(phi), -sin(phi); sin(phi), cos(phi)]

% rotation of sine-curve
S   = R*S;

% extract x and y again
t = S(1,:);
x = S(2,:);

% plot
figure(1)
plot(t,x)
axis equal
xlabel('sin(t)')  % even though we plot t() on the x-axis, it is actually the rotated sin(t)
ylabel('t')
