Question
MATLAB HELP .. SHOW CODE PLEASE

3. Stiff ODE The following second-order ODE is considered to be stiff. entre = -1001 - 1000.54 With ’ode45 command and the i
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Matlab code for the problem

clc; clear; %Clear command window and workspace
t = [0 15]; %Time period
initial = [2 0]; % Initial condition
% The RHS of ODEs
f = @(t,y) [y(2); -1001*y(2)-1000.5*y(1)];
[t,y] = ode45(f,t,initial); %Computing the solution using ODE45 function
x = y(:,1); dx = y(:,2); % Copying the results to another variable for saving
save HW8_4.dat x -ascii
save HW8_5.dat dx -ascii
% For yor reference plotting the soltion y and derivative
plot(t,x), xlabel('t'), ylabel('y'); %Plotting the solution
figure
plot(t,dx), xlabel('t'), ylabel('dy/dt'); %Plotting the first derivative

Screen Print of the code

600 OWN clc; clear; %clear command window and workspace t = [O 15]; %Time period initial = [20]; % Initial condition % The RHOUTPUT

The code will create two files HW8_4.dat and HW8_5.dat in the currwnt working directory

Figure 2 x Figure 1 x HW8_4.dat * CURRENT FOLDER Name GradeCalculate.m 1 HW8 4.dat !! HW8_5.dat Integralons Methods.m Jacobil

| 15 10 2 mm mm 1 % % 8 0 y.dy/dt

Add a comment
Know the answer?
Add Answer to:
MATLAB HELP .. SHOW CODE PLEASE 3. Stiff ODE The following second-order ODE is considered to...
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
  • Please provide the matlab code solution for this problem. Exercise 2 Consider the differential equation for...

    Please provide the matlab code solution for this problem. Exercise 2 Consider the differential equation for the Van der Pol oscillator (use ode45) which has a nonlinear damping term a (y -1) y 1. For E 0.25, solve the equation over the interval 0,50 for initial conditions y (0) 0.1 and y' (0) -1. TASK: Save y as a column vector in the file A04.dat TASK: Save y' as a column vector in the file A05.dat 2. For a 10,...

  • I want Matlab code. 23.8 The following nonlinear, parasitic ODE was suggested by Hornbeck (1975): d y di 5 ) If the...

    I want Matlab code. 23.8 The following nonlinear, parasitic ODE was suggested by Hornbeck (1975): d y di 5 ) If the initial condition is y(0) -0.08, obtain a solution from t-0 to 5: (a) Analytically (b) Using the fourth-order RK method with a constant step size of 0.03125. (c) Using the MATLAB function ode45. (d) Using the MATLAB function ode23s (e) Using the MATLAB function ode23tb. Present your results in graphical form. 23.8 The following nonlinear, parasitic ODE was...

  • Use MATLAB’s ode45 command to solve the following non linear 2nd order ODE: y'' = −y'...

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

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

  • Differential Equations with MATLAB/Plotting first order differential equations in Matlab/ Differential Equations MATLAB/IVP Matlab/IVP I'd really...

    Differential Equations with MATLAB/Plotting first order differential equations in Matlab/ Differential Equations MATLAB/IVP Matlab/IVP I'd really appreciate if I can get some help plotting these 3 first order differential equations as well as their comments. PLEASE! ANYTHING HELPS, I am very stuck :( EZplot and ODE 45 were mentioned in class and the instructions in class were not clear at all. Given the first order differential equation with initial condition. dy/dt = y t, y(0)=-1 Complete problems 1-3 in one...

  • Please show MATLAB code for how to gain solution. 10.1 Consider the following first-order ODE: from...

    Please show MATLAB code for how to gain solution. 10.1 Consider the following first-order ODE: from x -0 to 2.1 with (0) 2 (a) Solve with Euler's explicit method using h 0.7. (b) Solve with the modified Euler method using h - 0.7. r Runge-Kutta method using h 0.7. The analytical solution of the ODE is24. In each part, calculate the eror between the true solution and the numerical solution at the points where the numerical solution is determined

  • Problem #3: The Ralston method is a second-order method that can be used to solve an...

    Problem #3: The Ralston method is a second-order method that can be used to solve an initial-value, first-order ordinary differential equation. The algorithm is given below: 2 Yi+1 = yi + k +k2)h Where kı = f(ti,y;) 3 k2 = ft;+ -h, y; +-kih 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...

  • ME 32200 Programming course (MATLAB) 4. Please finish the following Matlab code for solving the ODE:...

    ME 32200 Programming course (MATLAB) 4. Please finish the following Matlab code for solving the ODE: dy = y(1+1) dt I.C. y(0) = 0 with the multi-step 4th order Milne's Method, and apply 4th order Runge Kutta method to the first 4 points (1 boundary point and the next 3 points). (Hint: 4th order Milne's Method Predictor: 7i+ = Y-3 +h(2f;- fi- +25,-2) Corrector: y = y + + +0. +45j + fi-) Where f; = f(t;,y,) and Fit =...

  • MATLAB 25. Do the following operations. - Write the MATLAB function and save it. function dxdt=difdenk(t,x)...

    MATLAB 25. Do the following operations. - Write the MATLAB function and save it. function dxdt=difdenk(t,x) dxdtax+5, Then solve this function with the following command on Command Window. [tx]=ode23('difdenk”,[02],0) plot(tx) xlabel(t) ylabel(y) Solve the following ordinary differential equation using MATLAB's Ordinary Differential Equation (ODE) solver with the initial condition of x(0) = 0 for a time span between 0 and 2. = x +t

  • Consider the following problem Solve for y(t) in the ODE below (Van der Pol equation) for...

    Consider the following problem Solve for y(t) in the ODE below (Van der Pol equation) for t ranging from O to 10 seconds with initial conditions yo) = 5 and y'(0) = 0 and mu = 5. Select the methods below that would be appropriate to use for a solution to this problem. More than one method may be applicable. Select all that apply. ? Shooting method Finite difference method MATLAB m-file euler.m from course notes MATLAB m-file odeRK4sys.m from...

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
ADVERTISEMENT