clc; clear all; close all; format short g %parámetros de simulación ------------------------------------------------\% ti=0; %tiempo inicial (segundos) tf=5; %tiempo de final (segundos) h=0.001; %incremento de tiempo (segundos) ts=ti:h:tf; %vector de tiempo ci=[0;0]; %condiciones iniciales opciones=odeset('RelTol',1e-3,'InitialStep',1e-3,'MaxStep',1e-3); %solución numérica del sistema -------------------------------------------\% [t,x]=ode45('cap8_pendulo',ts,ci,opciones); q1=x(:,1); qp1=x(:,2); [n,m]=size(t); tau1=zeros(n,1); qt1=zeros(n,1); xef=zeros(n,1); yef=zeros(n,1); for k=1:n [tau1(k), qt1(k)] = cap8_pdpendulo(q1(k),qp1(k)); frq=Rz(-pi/2)*cinematica_pendulo(0.45,q1(k),0.1); xef(k)=frq(1); yef(k)=frq(2); end subplot(2,2,1); plot(t,qt1) subplot(2,2,2); plot( t, tau1) subplot(2,2,3); plot(xef,yef) subplot(2,2,4); plot(qp1, qt1)