Find an approximate solution to the pendulum problem such that d2 theta /dt2 +g/l theta = 0. Use an approximate solver in matlab to find the solution to the exact equation d2 theta/dt2 +g/l * sin( theta) = 0. Compare the two solutions when the initial angle is 10, 30, and 90. Find a way to quantify the difference.
One approximate method for solving differential equations is Runge-Kutta, which in Matlab goes by the name ode45. I have made a template of how to solve a differential equation in matlab using ode45. Note that these are two separate files: Equations.m (the function that contains the differential equations) and Driving_Script2.m (the script that drives the solver).
Make 3 plots, with each plot showing the exact and approximate solution for each of the three angles. (The command "subplot" will make multiple plots on a single page. You will see that the exact and approximate solution are different. What I want you to do is to quantify how different the solutions are. Also, remember that matlab uses radians...(2*pi/360 * angle).
Template for solving a differential equation using ode45 in matlab:
% Driving_Script2.m (You can change the name)
clear all;
close all;
tspan = [0 10] ; Interval to be solved
y0 = [1.0 0] ; %initial condition here ...the first is angle, the second is velocity
% specify the equations to be solved using the approximate solver within the function Equations.m
[t,y] = ode45('Equations',tspan,y0)
figure(100)
h1=plot(t, y(:,1))
% Equations.m
function dy = Equations(t,y)
g= 9.81, l=2; % Constants here
%
dy = zeros(2,1);
dy(1) = y(2);
dy(2) = -g/l*sin(y(1));
%
Hey,
Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries
clc;
clear all;
close all;
g=9.81;
l=2;
f=@(t,th) [th(2);-(g*th(1))/l];
g=@(t,th) [th(2);-(g*sind(th(1)))/l];
tspan=[0 30];
y0=[30 0];
[t1,th1]=ode45(f,tspan,y0);
[t2,th2]=ode45(g,tspan,y0);
tspan=[0 30];
y0=[90 0];
[t3,th3]=ode45(f,tspan,y0);
[t4,th4]=ode45(g,tspan,y0);
tspan=[0 30];
y0=[10 0];
[t5,th5]=ode45(f,tspan,y0);
[t6,th6]=ode45(g,tspan,y0);
subplot(3,1,1)
plot(t1,th1(:,1),t2,th2(:,1),'r');
subplot(3,1,2)
plot(t3,th3(:,1),t4,th4(:,1),'r');
subplot(3,1,3)
plot(t5,th5(:,1),t6,th6(:,1),'r');
Kindly revert for any queries
Thanks.
Find an approximate solution to the pendulum problem such that d2 theta /dt2 +g/l theta =...
Problem #4. The convective heat transfer problem of cold oil flowing over a hot surface can be described by the following second-order ordinary differential equations. d'T dT +0.83x = 0 dx? dx T(0)=0 (1) T(5)=1 where T is the dimensionless temperature and x is the dimensionless similarity variable. This is a boundary-value problem with the two conditions given on the wall (x=0, T(O) = 0) and in the fluid far away from the wall (x = 5, T(5) = 1)....
Problem #4. The convective heat transfer problem of cold oil flowing over a hot surface can be described by the following second-order ordinary differential equations. der 0 dx T(0)=0 (1) T(5)=1 where T is the dimensionless temperature and x is the dimensionless similarity variable. dr? +0.83, dT This is a boundary-value problem with the two conditions given on the wall (x=0, T(O) = 0) and in the fluid far away from the wall (x = 5,7/5) = 1). You are...
answer in matlab code Employ the bvp4c command to find the approximate solution of the boundary value problem governed by the second-order nonhomogeneous differential equation, 9. with the boundary conditions of y(0) 5 and y(1)-2. Plot to compare the approximate solution with the exact solution obtained by using the dsolve command. Employ the bvp4c command to find the approximate solution of the boundary value problem governed by the second-order nonhomogeneous differential equation, 9. with the boundary conditions of y(0) 5...
MATLAB help please!!!!! 1. Use the forward Euler method Vi+,-Vi + (ti+1-tinti , yi) for i=0.1, 2, , taking yo-y(to) to be the initial condition, to approximate the solution at 2 of the IVP y'=y-t2 + 1, 0 2, y(0) = 0.5. t Use N 2k, k2,...,20 equispaced timesteps so to 0 and t-1 2) Make a convergence plot computing the error by comparing with the exact solution, y: t (t+1)2 exp(t)/2, and plotting the error as a function of...
1. Use Matlab to solve the differential equation (d^2φ/dt)=-(g/R)sin(φ), for the case that the board is released from φ0 = 20 degrees, using the values R = 5 m and g = 9.8 m/s^2 . Make a plot of φ against time for two or three periods. To do this, you'll need two .m files: one with your main code, which calls ode45, and one with the differential equation you're solving. 2. On the same picture, plot the approximate solution...
To illu • The initial value problem | |-0.5 -1][g x(0) = 1, y(0) = -1 is to be solved on the interval t € (0, 10] using the backward Euler method with step h = 0.01 The iteration update rule for the method is [ n+1) = (1 – hA)-- , where I is a 2 x 2 identity Lyn+1] matrix. Determine the approximate values of x(10) = (round to the fourth decimal place) and yr y(10) = (round...
Use the Fourier transform to find a solution of the ordinary differential equation u´´-u+2g(x) =0 where g∈L1. (The solution obtained this way is the one that vanishes at ±∞. What is the general solution?) 1. Use the Fourier transform to find a solution of the ordinary differential equation u" - u + 2g(x) = 0 where g E L. (The solution obtained this way is the one that vanishes at £oo. What is the general solution?) eg(y)dy eg(y)dy e Answer:...
Problem #3: The Ralston method is a second-order method that can be used to solve an initial-value, first-orde ordinary differential equation. The algorithm is given below: Vi#l=>: +($k+ş kz)h Where ky = f(ti,y:) * = f(mehr) You are asked to do the following: 3.1 Following that given in Inclass activity #10a, develop a MATLAB function to implement the algorithm for any given function, the time span, and the initial value. 3.2 Use your code to solve the following first-order ordinary...
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...