{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

linsysfinal

# linsysfinal - oo=ones(size(t ss=ones(size(t ss(jj)=zz(jj...

This preview shows pages 1–7. Sign up to view the full content.

Amber Mueller i) function [T]=ploti t=0:.1:5; T = t.*(one(t,0)-one(t,2)) plot (t,T, '.' ) function ss=one(t,aj) jj=find(t<aj); zz=zeros(size(t)); oo=ones(size(t)); ss=ones(size(t)); ss(jj)=zz(jj); return function [t,theta,thetaa]=parti clear all close all clc t0=0; tf=5; theta_init=[10*pi/180 0]; % approximate solution options = odeset( 'AbsTol' ,1e-8, 'RelTol' ,1e-8); [t,theta]=ode45(@eom,[t0 tf],theta_init,options); % analytic solution

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Amber Mueller thetat = (0.011+0.033.*t+2.*exp(-5.*t).*(.00529.*cos(2.19.*t) +.00367.*sin(2.19.*t))+0.011+0.033.*(t-2)+2.*exp(-5.*(t- 2)).*(.00529.*cos(2.19.*(t-2))+.00367.*sin(2.19.*(t-2)))+.067+2.*exp(- 5.*(t-2)).*(-.033*cos(2.19.*(t-2))-.0766.*sin(t-2))+.8*exp(- 5.*t).*sin(2.19.*t)+2*exp(-5.*t).*(-2.19/25.1.*cos(2.19.*t) +5/25.1.*sin(2.19.*t))).*one(t,0); % compare approximate vs. analytic solutions plot(t,thetat, 'g-' ,t,theta(:,1), 'r--' ) xlabel( 'time (s)' ) ylabel( 'theta(t)' ); legend( 'Analytic' , 'Numeric' ); title( 'parti' ) function ss=one(t,aj) jj=find(t<aj); zz=zeros(size(t));

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: oo=ones(size(t)); ss=ones(size(t)); ss(jj)=zz(jj); return % EOM file function [thetadot]=eom(t,theta) thetadot = zeros(2,1); T = t.*(one(t,0)-one(t,2)); thetadot(1)=theta(2); thetadot(2)=T-10*theta(2)-29.81*theta(1); return ; Amber Mueller k) function [t,x]=finalk for r=1:5 x0=[r;0]; t0=0; tf=20; options=odeset( 'AbsTol' ,1e-8, 'RelTol' ,1e-8); [t1,x]=ode45(@eom1,[t0 tf],x0,options); [t2,theta]=ode45(@eom2,[t0 tf],x0,options); figure(r) plot(t1,x(:,1), 'g-' ,t2,theta(:,1), 'r--' ) legend( 'Non-Linear' , 'Linear' ); end function xdot=eom1(t,x) xdot=zeros(2,1); xdot(1)=x(2); xdot(2)=-(10*x(2)+20*x(1)+9.81*sin(x(1))+.001885*x(2)^2); return function [thetadot]=eom2(t,theta) thetadot = zeros(2,1); thetadot(1)=theta(2); thetadot(2)=-10*theta(2)-29.81*theta(1); return ; deltheta(0)=1 deltheta(0)= 2 Amber Mueller deltheta(0)=3 Amber Mueller deltheta(0)= 4 Amber Mueller deltheta(0)=5 Amber Mueller...
View Full Document

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern