Here is the odefunction :
and Script for solving:
Text:
Function :
function dsdt = odefunction(t,s)
m = 0.1;
g = 10;
L = 1;
r = 0.5;
dsdt = zeros(2,1); % initializing
dsdt
dsdt(1) = s(2);
% Setting 1st element
dsdt(2) = (-3/4)*(m*g*L*cos(s(1)) +
m*r^2)/(m*L^2); % 2nd element
Script :
s0 = [pi/6 0.1];
%Initial Conditions [theta(0) theta_dot(0)]
tspan = [0 10]; %
time span
[t,s] = ode45(@(t,s)
odefunction(t,s),tspan,s0); % Solving
ODE
% t is time vector and s is solution vector
plot(t,s(:,1))
% plot theta vs t
hold on
plot(t,s(:,2))
% plot theta_dot vs t
legend(["\theta","\theta dot"],'Location','Best')
xlabel("Time [sec]")
% recall our assumptions s(1) = theta, s(2) = theta_dot
FOUR-Matlab Solve the following equation of motion using Matlab ODE45: 4 -m 6(0) 6(0)-0.1 (0) 0.2...
Q.1 Solve the following differential equation in MATLAB using solver ‘ode45’ dy/dt = 2t Solve this equation for the time interval [0 10] with a step size of 0.2 and the initial condition is 0.
solve it using the equation (6-41) on MATLAB. Use Matlab software to plot the following equation 6-44 from the text book Let Vo = 50, R = 10 12, rl = 112, and D is variable, OsDs 1 D (a) Efficiency vs. D 1.0 Ideal 0.8 0.6 Efficiency Nonideal 0.4 0.2 0 0.2 1 0.4 0.6 0.8 1.0 D (6) Figure 6-10 Boost converter for a nonideal inductor. (a) Output voltage; (b) Boost converter efficiency. P V2/R n = (6-43)...
Matlab Code for these please. 4. Using inbuilt function in MATLAB, solve the differential equations: dx --t2 dt subject to the condition (01 integrated from0 tot 2. Compare the obtained numerical solution with exact solution 5. Lotka-Volterra predator prey model in the form of system of differential equations is as follows: dry dt dy dt where r denotes the number of prey, y refer to the number of predators, a defines the growth rate of prey population, B defines the...
im having trouble doing this problem with matlab code and we can not use ode45 in our code unfortunitely. thank you! T L =undeformed length k =stiffness om The mass m is suspended from an elastic cord with an extensional stiffness k and undeformed length L. If the mass is released from rest at 0 = 60° with the cord unstretched, find the length r of the cord when the position =0 is reached for the first time. The differential...
4. Using Matlab: 4.1. Plot | H(n the following cases: (the frequency range: 0-20 KHz) a. a 0.2 0.5 ms. b. α-0.8 C.α-0.2 c-0.1 ms. c 0.5 ms. 4.2. Consider a signal whose Fourier Transform is given by: 50000ω Plot the transfer function l x(o) l and the output l Y(o) l in each of the above cases (stated in part 4.1) 4.3. Find the Inverse Fourier Transorms of| X(oand Y(o) , and generate the audio signals x and y...
Solve the ordinary differential equation using the numerical solver ode45: dw/dt=7e^(-t) where x(0)=0 Plot(t,x) for t=0:0.02:5 in Matlab
SOLVE USING MATLAB PLEASE THANKS! The governing differential equation for the deflection of a cantilever beam subjected to a point load at its free end (Fig. 1) is given by: 2 dx2 where E is elastic modulus, Izz is beam moment of inertia, y 1s beam deflection, P is the point load, and x is the distance along the beam measured from the free end. The boundary conditions are the deflection y(L) is zero and the slope (dy/dx) at x-L...
Solve the following differential equation using MATLAB's ODE45 function. Assume that the all initial conditions are zero and that the input to the system, /(t), is a unit step The output of interest is x dt dt dt To make use of the ODE45 function for this problem, the equation should be expressed in state variable form as shown below Solve the original differential equation for the highest derivative dt 2 dt Assign the following state variables dt dt Express...
Use MATLAB’s ode45 command to solve the following non linear 2nd order ODE: y'' = −y' + sin(ty) where the derivatives are with respect to time. The initial conditions are y(0) = 1 and y ' (0) = 0. Include your MATLAB code and correctly labelled plot (for 0 ≤ t ≤ 30). Describe the behaviour of the solution. Under certain conditions the following system of ODEs models fluid turbulence over time: dx / dt = σ(y − x) dy...
Question 2 The pendulum shown in Figure 2 consists of a concentrated mass m attached to a rod whose mass is small compared to m. The rod's length is L. The equation of motion for this pendulum is Suppose that L 1 m and g 9.81 m/s2. Use MATLAB to solve this equation using symbolic and numerical techniques for, θ(t) for two cases: , θ(0)-0.5 rad and, θ(0)-0.8 rad. In both cases 0(0) 0. Figure 2- A pendulum [3 marks]...