# analytical dynamics 2 projects

*label*Science

*timer*Asked: Dec 26th, 2017

*account_balance_wallet*$40

**Question description**

DEADLINE IS STRICT 46 HRS FROM NOW , EVEN AN HR MORE , I WILL NOT BE ABLE TO PAYUSE OF MATLAB IS MUST

## Tutor Answer

sorry for the late, attached is my answer

The MATLAB code for crane is shown below:

function [input]= Crane(n,count1,begin,the_final,

d_A,d_B,theta_epsilon_final,nominaleps)

syms epsilon;

R = zeros(2*count1+2,2*count1+2);

r = zeros(2*count1+2,1);

INI = simplify(d_A^(2*count1+2));

steps = (2*count1+2)^2;

step = 0;

h = waitbar(0,'input calculated');

for j = 1:2*count1+2

f = simplify(d_A^(j-1)*d_B);

s=0;

for i = 1:count1

for m = 1:n-s

R(s+2*(i-1)+m,j) = real(1/factorial(i1)*subs(f(m+s),epsilon,nominaleps));

step = step+1;

waitbar(step/steps)

end

f=simplify(diff(f, sym('epsilon'), 1));

s=2;

end

end

s = 0;

for i=1:count1

ini = -(1/factorial(i-1))*subs(diff(INI* begin ', sym('epsilon'), (i1)),epsilon,nominaleps);

for count = 1:n-s

r(s+2*(i-1)+ count) = ini(count +s);

end

s = 2;

end

close(h)

for count = 1:n

r(count) = r(count)+ the_final(count);

end

if count1>1

r(5) = r(5)+theta_epsilon_final;

end

input = flipud(R\r);

end

The math equations for crane is shown below:

According to the above analysis, it can be verified that the above solution is correct.

The MATLAB code for pendulum is shown below:

g = 9.8;

l = 5;

ini_angle1 = pi/3;

ini_angle2 = 0;

pend_x = 0;

pend_y = l;

fprintf('simulation')

choice = input('1 = phase portrait; 2 = time serie');

iterations = 1;

time_pause = 0.2;

run = 40;

tx = 0;

deq1=@(t,x) [x(2); -g/l * sin(x(1))];

[t,sol] = ode45(deq1,[0 run],[ini_angle1 ini_angle2]);

s1 = sol(:,1)';

s2 = sol(:,2)';

arraysize = size(t);

timestep = t(run) - t(run-1);

Cx = l*sin(s1);

Cy = l*cos(s2);

for i = 1 : max(arraysize)

subplot(2,1,1)

plotx = [pend_x Cx(iters)];

ploty = [pend_y Cy(iters)];

plot(Cx(iters),Cy(iters),'ko',plotx,ploty,'r-')

title(['pendulum \theta = ' num2str(s1(iters))],'fontsize',15)

xlabel('x [m]','fontsize',15)

ylabel('y [m]','fontsize',15)

axis([min(Cx) max(Cx) min(Cy) max(Cy)])

subplot(3,2,3)

if choice == 1

plot(s1(iters),s2(iters),'bo')

hold on

title(' phase portrait','fontsize',15)

xlabel('\alpha1','fontsize',12)

ylabel('\alpha2','fontsize',12)

axis([min(s1) max(s1) min(s2) max(s2)])

elseif choice == 2

plot(t(iters),s1(iters),'bo')

title([' time series \alpha1 t = ' num2str(t(iters))],'fontsize',15)

xlabel('t [seconds]','fontsize',15)

ylabel('\alpha1...

*flag*Report DMCA

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors