Answered step by step
Verified Expert Solution
Question
1 Approved Answer
MATLAB question: How do I solve the extra credit question at the bottom? Matlab version 2017b Problem 1: A car, initially at rest, accelerates in
MATLAB question: How do I solve the extra credit question at the bottom? Matlab version 2017b
Problem 1: A car, initially at rest, accelerates in x direction with the following expression: a(t) = 5 sech2(- ) tanh(- 20 ) 20 where a is acceleration and t is time. In this exercise, you are to explore the motion of the car numerically using Euler method. The motion is described by the following differential equations: 5sech2G )tanh( ) dt dr dt 20 20 where u is velocity. Using Euler method and capital letters to denote the approximation, the equations can be approximated by T, n+1 ) tanhi 20 where subscript n denotes variables at current time, subscript n+1 denotes variables at a time that is t ahead. Write function car.m to numerically solve for the motion of the car. The function should have the following header: function [T, X, Ucar(Tf, dt). The inputs are total traveling time Tf and the time step dt. The outputs vectors T, X and U are the time distance and velocity of the car, respectively. Give the function a description (a) Set pla evalc('help car) Set the answers to plb, plc, and pld, respectively. Use 5-second time step velocity into ple, plf, and plg, respectively (b.c,d) Use function car to get the time, distance, and velocity of the car for Tf-60 s. (e,f,g) Repeat the step above with 1-second time step. Put the time, distance, and (h) Create figure 1. Use function subplot to include 2 panels with one on top of the other. Plot distance versus time in the top panel. The top panel should include 2 curves the 5-second time step in parts (b,c) and the 1-second time step in parts (e,f). Plot velocity versus time in the bottom panel. The bottom panel should also include 2 curves: the 5- second time step in parts (b,d) and the 1-second time step in parts (e,g). Use different solid symbols (no line) for the curves . Set p1h:See figure 1' An 6-point ertra credit will be given if you include the analytical solution of the distance and velocity in the figure. Use solid line to denote the solution which can be obtained by integrating the differential equations as you had done in your math/physics classStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started