Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Plz write codes only using MATLAB following the instruction below there should be 2 files named damped.m and plotDamped.m Problem 2 - Functions and Animation
Plz write codes only using MATLAB following the instruction below
there should be 2 files named "damped.m" and "plotDamped.m"
Problem 2 - Functions and Animation Part 1 - User Defined Function - Creating damped.m 1. Write a user defined function and save it in a file named damped. m with an input of x and ain y. Enter your name and section number as comments in the function file. The MATLAB function damped (x) should evaluate the mathematical function defined by: y(x)= e 4 cos(2t-) 2.5 The function must be written such that x can be a scalar or a vector input. Part 2 - Creating plotDamped.m Create a script called plotDamped.m and place comments at the top of the program (header) that includes: Name, Section, Date, and File Title. Create a vector called myX of evenly spaced values between 0 and 8 with 200 points. Call the function damped with the vector myx created in #3 as the only input argument Create an animated plot using the output of damped. m over the domain defined in #3. The animation should have a red circle trace the outline of this function, with a trailing blue line behind it. An image of the plot during the animation is shown below. 2. 3. 4. 5. Damped Animation 02 X values Similarly, the y-axis should The x-axis should have a minimum value of 0 and a maximum value of 8. have a minimum value of-1 and a maximum value of 1. 6. 7. Label the x-axis with 'x values' and the y-axis with 'y values' and title the plot 'Damped AnimationStep 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