Question

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 sys

0 0
Add a comment Improve this question Transcribed image text
Answer #1

MATLAB CODE:

clc;
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')

OUTPUT:

Improved Euler solution plot for wa1. 10 2 -6 -10 50 100 150 time in secIN EXCEL FORMATE

Matlab code for Euler and Heuns method for 2d clear all close all 888888움움88,,88움움88888888888888움움88888888888888888888888888

%initial guess iteration for x and y using improved Euler method x _huen (1)x0; y_huen(1)-y_0 t_huen ( 1)=0; tend-150; n (t_e


Add a comment
Know the answer?
Add Answer to:
I have to do this in excel but I dont understand how to do that. I've never used excel for this.
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 9imereal Condltion and note the behavior of the system. xercise 5. For this exercise you will app...

    using improved eulers method using excel 9imereal Condltion and note the behavior of the system. xercise 5. For this exercise you will approximate the solution of an undamped periodically forced mass-spring system with mass m and spring constant k = 1.The second order equation for this system is given by x(t)" + x(t) = Cos(at). Use the initial conditions x(0) = 0 and x'(0) =y(0)-0. Use the improved Euler's method and Excel to generate plots of x(t) versus time for...

  • 1. A 1 kg mass is attached to a spring of spring constant k = 4kg/82, The spring-mass system is a...

    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)...

  • I've got parts a-c and understand them. However, I do not understand the rest of the problem and how to solve for th...

    I've got parts a-c and understand them. However, I do not understand the rest of the problem and how to solve for the answers in parts d and e. Any explanation would be helpful. (1 point) A mass of 4 kg stretches a spring 40 cm. The mass is acted on by an external force of F(t) = 97 cos(0.5t) N and moves in a medium that imparts a viscous force of 8 N when the speed of the mass...

  • QUESTION 4 This question will reinforce how the Bode plot provides the steady-state response for ...

    QUESTION 4 This question will reinforce how the Bode plot provides the steady-state response for a linear system in response to a sinusoidal input. Consider this forced mass-spring-damper system: Let M 6, B-48, K-72 Part a) As you did for HW 1, determine steady-state solution "x,()" when FC) 3120 cos(4b) Part b) Determine the transfer function Part c) The Bode plots for the transfer function of Part b are provided in this handout. with the parameter values of Part a....

  • If an undamped spring-mass system with a mass that weighs 6 lb and a spring constant...

    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

  • ® Consider a damped unforced mass-spring system with m 1, γ 2, and k 26. a) (2 points) Find if th...

    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...

  • Consider a forced spring-mass equation of the form x′′ + x = cos(ωt) with initial conditions...

    Consider a forced spring-mass equation of the form x′′ + x = cos(ωt) with initial conditions x(0) = 1 and x′(0) = 0. a) Suppose ω doesnt = 1, find the solution to the IVP. b)If ω = 1, find the solution to the IVP. c)In which of the two cases does the phenomenon of pure resonance occur? Ex- plain your answer. d)Verify that with ω = 9/10, x(t) = 100 (cos( 9t ) − 81 cos t) solves the...

  • a can be skipped Consider the following second-order ODE representing a spring-mass-damper system for zero initial...

    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)...

  • Learning Goal: To understand the application of the general harmonic equation to the kinematics of a...

    Learning Goal: To understand the application of the general harmonic equation to the kinematics of a spring oscillator. One end of a spring with spring constant k is attached to the wall. The other end is attached to a block of mass m. The block rests on a frictionless horizontal surface. The equilibrium position of the left side of the block is defined to be x=0. The length of the relaxed spring is L. (Figure 1) The block is slowly...

  • .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 resp...

    .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...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT