Está en la página 1de 2

function rotacionz

t = input('Da el ngulo:\n');%va a pedir el angulo para la rotacion


tr = t*pi/180;%Convierte a radianes
Rz = [cos(tr) -sin(tr) 0 ; sin(tr) cos(tr) 0 ; 0 0 1];
Rz

end

function normu(p)

norma = sqrt(p'*p);%sqrt reaiz cuadrada,comilla transpuesta


norma

end

function rotacion

eje = input('Dame el eje x(1),y(2),z(3):\n')


switch eje
case 1
t = input('Da el ngulo:\n');%va a pedir el angulo para la rotacion
tr = t*pi/180;%Convierte a radianes
Rx = [1 0 0 ; 0 cos(tr) -sin(tr) ; 0 sin(tr) cos(tr)];
Rx
assignin('base','Rx', 'Rx')
case 2
t = input('Da el ngulo:\n');%va a pedir el angulo para la
rotacion
tr = t*pi/180;%Convierte a radianes
Ry = [ cos(tr) 0 sin(tr) ; 0 1 0 ; -sin(tr) 0 cos(tr)];
Ry
assignin('base','Ry', 'Ry')
case 3

t = input('Da el ngulo:\n');%va a pedir el angulo para la rotacion


tr = t*pi/180;%Convierte a radianes
Rz = [cos(tr) -sin(tr) 0 ; sin(tr) cos(tr) 0 ; 0 0 1];
Rz
assignin('base','Rz', 'Rz')

end

Robtica Industrial / Funciones MATLAB 1/2


function rotacionz

t = input('Da el ngulo:\n');%va a pedir el angulo para la rotacion


tr = t*pi/180;%Convierte a radianes
Rz = [cos(tr) -sin(tr) 0 ; sin(tr) cos(tr) 0 ; 0 0 1];
Rz

end

function y = rotacionzm

t = input('Da el ngulo:\n');%va a pedir el angulo para la rotacion


tr = t*pi/180;%Convierte a radianes
Rz = [cos(tr) -sin(tr) 0 ; sin(tr) cos(tr) 0 ; 0 0 1];

y = Rz

end

function rotacionpura

xb=input('Dame xb:\n');
yb=input('Dame yb:\n');
zb=input('Dame zb:\n'); % solicitud de entradas

pb=[xb;yb;zb]
t=input('Dame el ngulo: \n');
tr=t*pi/180;
rz =[cos(tr) -sin(tr) 0; sin(tr) cos(tr) 0; 0 0 1];
pa=rz*pb;
pa
end

function tabladh
syms Tabla
n=input('Dame tus renglones? \n');
for i=1:n
for r=1:4
prompt = 'Cual es tu simbolo? \n';
str = input(prompt,'s');
Tabla(i,r) = str;
end
end

Tabla
end

Robtica Industrial / Funciones MATLAB 2/2

También podría gustarte