Question: Using MATLAB, simulate the response of both the linear and the nonlinear differential equation models for the simple pendulum discussed in class. Run the following

Using MATLAB, simulate the response of both the linear and the nonlinear differential equation
models for the simple pendulum discussed in class. Run the following cases. Use L=0.5m, and g
=9.81ms2.
a.0?P=I ?8rad and 0=0rads
b.0?P=I ?4rad and 0=0rads
For each case, provide a properly labeled plot of the angular position (rad) and angular velocity
(rads) on the same graph over the interval of 0 to 3sec. Compare the response (i.e., motion
range, and frequency) between the linear and nonlinear models for both cases. Note that the
model for the pendulum is a nonlinear differential equation. Below is an example of how to
solve a non-linear differential equation in MATLAB. The example is:
y-10cosy=0
Modify this code to represent the equation for the pendulum.
Solving a nonlinear differential equation: ydotdot -10cosy=0
function example
tspan=[0,5];, Define the time interval
y0=[0;0];,@0 Define the initial conditions for y and y dot
[t,y]= ode45(@nf, tspan, y0); Call function ode45 to solve equation
P Plot of the solution
plot (t,y(:,1),?'k-?',t,y(:,2),?'k--?'); % plot y and ydot
% Add label
Add legend
:. Add title
% Add your name to each plot
end %end of example
--------
function dydt =nf(t,y)
dydt =[y(2);10.0**cos(y(1))];, define the differential equation here
end %end of dydt
For modeling the linear motion of the pendulum, create another copy of the nf
function for the pendulum calling it lf, and replace sin(y(1)) with just y(1).
 Using MATLAB, simulate the response of both the linear and the

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!