Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MATLAB ONLY MATLAB ONLY NO FPRINT NO WHILE ONLY FOR AND IFMATLAB ONLY MATLAB ONLY NO FPRINT NO WHILE ONLY FOR AND IFMATLAB ONLY MATLAB

image text in transcribedMATLAB ONLY MATLAB ONLY NO FPRINT NO WHILE ONLY FOR AND IFMATLAB ONLY MATLAB ONLY NO FPRINT NO WHILE ONLY FOR AND IFMATLAB ONLY MATLAB ONLY NO FPRINT NO WHILE ONLY FOR AND IFMATLAB ONLY MATLAB ONLY NO FPRINT NO WHILE ONLY FOR AND IFMATLAB ONLY MATLAB ONLY NO FPRINT NO WHILE ONLY FOR AND IFMATLAB ONLY MATLAB ONLY NO FPRINT NO WHILE ONLY FOR AND IF

image text in transcribed

$ % plotdamped.m $ This program plots the following equation related to damped motion. f(x) = e^(-x/a) *cos(2*pi*x/lambda) % The script allows a and lambda to be varied. % Author: Andrew Bartolini $ Date: January 23, 2019 % clear memory clear % Clear Command Window clc $ close all figures close all; $% Set parameters % Set the parameters that can be varied in the program a = 2; lambda = 0.5; % Specify the properties related to the x vector xmin = 0; xmax = 10; Nx = 200; % this value changes how coarse the plot looks %% Calculate the vectors % Create the x vector using the linspace command. x = linspace(xmin, xmax, Nx); % Calculate the y vector using the equation listed in the header y = exp(-x/a). *cos(2*pi*x/lambda); %% Plot the results % Create a new figure with the figure function figure Plot the results using the plot function plot(x,y) % Label the axes xlabel('x') ylabel('y') & Give the figure a title title('plotdamped.m') $ Turn the grid on grid on 5. Animating Damped Motion // Filename: animatedamped.m Start with the plotdamped.m code that you completed for Homework 2. Change the code so there is a variable doAnimate that is set at the beginning of the code and is either true or false. If do Animate is false, the program should create a plot of the curve with no animation. If doAnimate is true, the plot must now be animated, showing the current point as a red circle and the previous points as a blue line (similar to the sine wave in the animation videos). Failure to use these line styles, markers and colors will result in you losing points. $ % plotdamped.m $ This program plots the following equation related to damped motion. f(x) = e^(-x/a) *cos(2*pi*x/lambda) % The script allows a and lambda to be varied. % Author: Andrew Bartolini $ Date: January 23, 2019 % clear memory clear % Clear Command Window clc $ close all figures close all; $% Set parameters % Set the parameters that can be varied in the program a = 2; lambda = 0.5; % Specify the properties related to the x vector xmin = 0; xmax = 10; Nx = 200; % this value changes how coarse the plot looks %% Calculate the vectors % Create the x vector using the linspace command. x = linspace(xmin, xmax, Nx); % Calculate the y vector using the equation listed in the header y = exp(-x/a). *cos(2*pi*x/lambda); %% Plot the results % Create a new figure with the figure function figure Plot the results using the plot function plot(x,y) % Label the axes xlabel('x') ylabel('y') & Give the figure a title title('plotdamped.m') $ Turn the grid on grid on 5. Animating Damped Motion // Filename: animatedamped.m Start with the plotdamped.m code that you completed for Homework 2. Change the code so there is a variable doAnimate that is set at the beginning of the code and is either true or false. If do Animate is false, the program should create a plot of the curve with no animation. If doAnimate is true, the plot must now be animated, showing the current point as a red circle and the previous points as a blue line (similar to the sine wave in the animation videos). Failure to use these line styles, markers and colors will result in you losing points

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2010 Barcelona Spain September 2010 Proceedings Part 2 Lnai 6322

Authors: Jose L. Balcazar ,Francesco Bonchi ,Aristides Gionis ,Michele Sebag

2010th Edition

364215882X, 978-3642158827

More Books

Students also viewed these Databases questions

Question

2. How should this be dealt with by the organisation?

Answered: 1 week ago

Question

explain what is meant by the term fair dismissal

Answered: 1 week ago