using improved eulers method using excel
%Matlab code for Euler and Heun's method for 2d
clear all
close all
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%functions for improved Euler method for w=1
w=1;
f=@(t,x,y) y;
g=@(t,x,y) -x+cos(w*t);
%step size
h=0.1;
%Initial guess
x_0=0; y_0=0;
%iteration for x and y using improved Euler method
x_huen(1)=x_0; y_huen(1)=y_0;
t_huen(1)=0; t_end=50;
n=(t_end-t_huen)/h;
for i=1:n
t_huen(i+1)=t_huen(i)+h;
m1=f(t_huen(i),x_huen(i),y_huen(i));
m2=g(t_huen(i),x_huen(i),y_huen(i));
p1=f(t_huen(i+1),x_huen(i)+h*m1,y_huen(i)+h*m2);
p2=g(t_huen(i+1),x_huen(i)+h*m1,y_huen(i)+h*m2);
x_huen(i+1)=x_huen(i)+(h/2)*(m1+p1);
y_huen(i+1)=y_huen(i)+(h/2)*(m2+p2);
end
figure(1)
plot(t_huen,x_huen)
xlabel('time in sec.')
ylabel('x(t)')
title('Improved Euler solution plot for w=1')
clear x_huen; clear y_huen; clear t_huen
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%functions for improved Euler method for w=1
w=1.1;
f=@(t,x,y) y;
g=@(t,x,y) -x+cos(w*t);
%step size
h=0.1;
%Initial guess
x_0=0; y_0=0;
%iteration for x and y using improved Euler method
x_huen(1)=x_0; y_huen(1)=y_0;
t_huen(1)=0; t_end=150;
n=(t_end-t_huen)/h;
for i=1:n
t_huen(i+1)=t_huen(i)+h;
m1=f(t_huen(i),x_huen(i),y_huen(i));
m2=g(t_huen(i),x_huen(i),y_huen(i));
p1=f(t_huen(i+1),x_huen(i)+h*m1,y_huen(i)+h*m2);
p2=g(t_huen(i+1),x_huen(i)+h*m1,y_huen(i)+h*m2);
x_huen(i+1)=x_huen(i)+(h/2)*(m1+p1);
y_huen(i+1)=y_huen(i)+(h/2)*(m2+p2);
end
figure(2)
plot(t_huen,x_huen)
xlabel('time in sec.')
ylabel('x(t)')
title('Improved Euler solution plot for w=1.1')
clear x_huen; clear y_huen; clear t_huen
fprintf('\tFor w=1 the period of envelop is higher than that of w=1.1 \n')
%%%%%%%%%%%%%%%%%%%%%%%% End of code %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9imereal Condltion and note the behavior of the system. xercise 5. For this exercise you will app...
I have to do this in excel but I dont understand how
to do that. I've never used excel for this.
the system Exercise 5. For this exercise you will approximate the solution of an undamped periodically forced mass-spring system with mass m 1 and spring constant k 1.The second order equation for this system is given by x(t)" + x(t)= Cos(wt) Use the initial conditions x(0)-0 and x' (0)-y(0)-O. Use the improved Euler's method and Excel to generate plots...
Consider the forced but undamped system described by the initial value problem 3cosuwt, (0) 0, (0 2 (a) Determine the natural frequency of the unforced system (b) Find the solution (t) forw1 (c) Plot the solution x(t) versus t for w = 0.7, 0.8, and 0.9. (Feel free to use technology. MatLab, Mathematica, etc.) Describe how the response (t) changes as w varies in this interval. What happens as w takes values closer and closer to 1? Briefly explain why...
Number 2
1. a) The displacement x of a forced spring-mass system is governed by dx d2x dt2 + (1 + t)x2 = sint t> 0 x(0) = 0 dx (0) = 0 dt dt Obtain the first four non-zero terms of the solution using the Taylor expansion approach. b) Calculate the position and velocity of the mass at t = 0.5 using the result of part (a). a) The displacement x of a forced spring-mass system is governed by...
If an undamped spring-mass system with a mass that weighs 6 lb and a spring constant 1 lb/in is suddenly set in motion at t = 0 by an external force of 3 cos 7t lb, determine the position of the mass at any time. (Use g = 32 ft/s2 for the acceleration due to gravity. Let u(t), measured positive downward, denote the displacement in feet of the mass from its equilibrium position at time t seconds.) u(t) = ft
.matlab
Objective: This activity has the purpose of helping students to to use either Simulink or VisSim to simulate the system behavior based on its Block Diagram representation and plot its response. Student Instructions: The following spring-mass-damper system has no external forcing, that is u(0)-0. At time t- 0 it has an initial condition for the spring, which it is distended by one unit: y(0)-1. The system will respond to this initial condition (zero-input-response) until it reaches equilibrium. 0)1initial condition...
help, pls tq.
4. Consider the first order autonomous system d13-1 0)-1. (a) Estimate the solution of the system (1) at t0.2 using two steps of Euler's method with 2v, u(0)0 step-size h 0.1 T1+C2+A1-4 (b) An autonomous system of two first order differential equations can be written as: du dt=f(mu), u(to) = uo, dv dt=g(u, u), u(to) to. The Improved Euler's scheme for the system of two first order equations is tn+1 = tn + h, Use the Improved...
a can be skipped
Consider the following second-order ODE representing a spring-mass-damper system for zero initial conditions (forced response): 2x + 2x + x=u, x(0) = 0, *(0) = 0 where u is the Unit Step Function (of magnitude 1). a. Use MATLAB to obtain an analytical solution x(t) for the differential equation, using the Laplace Transforms approach (do not use DSOLVE). Obtain the analytical expression for x(t). Also obtain a plot of .x(t) (for a simulation of 14 seconds)...
Objective: This activity has the purpose of helping students to to use either Simulink or VisSim to simulate the system behavior based on its Block Diagram representation and plot its response Student Instructions: The following spring-mass-damper system has no external forcing, that is Lu(0) 0. At time t"0 it has an initial condition for the spring, which it is distended by one unit; yO) 1. The system will respond to this initial condition (zero-input-response) until it reaches equilibriunm. | yin«...
Differntial Equations Forced Spring Motion
1. A 1 kg mass is attached to a spring of spring constant k = 4kg/82, The spring-mass system is attached to a machine that supplies an external driving force of f(t) = 4 cos(wt). The systern is started from equilibrium i.e. 2(0) = 0 and z'(0) = 0. There is no damping. (a) Find the position x(t) of the mass as a function of time (b) write your answer in the form r(t)-1 sin(6t)...
solve d ,e , f, g
® Consider a damped unforced mass-spring system with m 1, γ 2, and k 26. a) (2 points) Find if this system is critically damped, underdamped, or overdamped. b) (4 points) Find the position u(t) of the mass at any time t if u(0)-6 and (0) 0. c) (4 points) Find the amplitude R and the phase angle δ for this motion and express u(t) in the form: u(t)-Rcos(wt -)e d) (2 points) Sketch...