Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Physical Setup A ball is placed on a beam, see figure below, where it is allowed

ID: 3813802 • Letter: P

Question

Physical Setup A ball is placed on a beam, see figure below, where it is allowed to roll with 1 degree of freedom along the length of the beam. A lever arm is attached to the beam at one end and a servo gear at the other. As the servo gear turns by an angle 0, the lever changes the angle of the beam by a. When the angle is changed from the horizontal position, gravity causes the ball to roll along the beam. A controller will be designed for this system so that the ball's position can be manipulated. Beam Ball Lever Arm Gear Figure 3: Ball and beam system in Problem #5. System Parameters: For this problem, we will assume that the ball rolls without slipping and friction between the beam and ball is negligible. The constants and variables for this problem are defined as follows: (m) mass of the ball 30.11 (kg) (R) radius of the ball 0.015 (m) (d) lever arm offset -0.03 (m) (g) gravitational acceleration 9.8 (m/s2 (L) length of the beam 1.0 (m) (J) s moment of inertia >9.99X10 6 (kg.m2) (r) ball position coordinate a beam angle coordinate (0) servo gear angle System Equations: The second derivative of the input angle a actually affects the second deriva- tive of r. However, we will ignore this contribution. The Lagrangian equation of motion for the ball is then given by the following: ma r mg sin a mra (3) Linearization of this equation about the beam angle, a 0, gives us the following linear approxi mation of the system (4) mga The equation which relates the beam angle to the angle of the gear can be approximated as linear by the equation below

Explanation / Answer

#include <stdio.h>
#include <stdlib.h>

struct btnode
*root = NULL, *temp = NULL, *t2, *t1;

void delete1();
void insert();
void delete();
void inorder(struct btnode *t);
void create();
void search(struct btnode *t);
void preorder(struct btnode *t);
void postorder(struct btnode *t);
void search1(struct btnode *t,int data);
int smallest(struct btnode *t);
int largest(struct btnode *t);

int flag = 1;

void main()


/* To create a node */
void create()


/* recursive function to perform inorder traversal of tree */
void inorder(struct btnode *t)

else if ((data < t->value))
  
else if ((data==t->value))
  
}

/* To delete a node */
void delete1(struct btnode *t)

else
  
t = NULL;
free(t);
return;
}

/* To delete node having one left hand child */
else if ((t->r == NULL))
  
else if (t1->l == t)
  
else
  
t = NULL;
free(t);
return;
}

/* To delete node having manus kid */
else if (t->l == NULL)
  
else if (t1->r == t)
t1->r = t->r;
else
t1->l = t->r;
t == NULL;
free(t);
return;
}

/* To delete node having 2 kid */
else if ((t->l != NULL) && (t->r != NULL))
  
else
  
search1(root, k);
t->value = k;
}

}

/* to search out the littlest part within the right sub tree */
int smallest(struct btnode *t)

else
come (t->value);
}

/* to search out the biggest part within the left sub tree */
int largest(struct btnode *t)

else
return(t->value);
}