Fix the bugs in this matlab program so that it solves. clear clf clc time = linspace(0, 5, 100); m...

60.1K

Verified Solution

Question

Mechanical Engineering

Fix the bugs in this matlab program so that it solves.

clear
clf
clc
time = linspace(0, 5, 100);
m = 1; k = 100; c = 1; delta = 0.2;
[period, response] = Exmp(m, k, c, delta, time);
plot(time, response)
grid
%Exmp(m, k, c, delta, time)
%
%________________________________________
function [T, x] = Exmp(m, k, c, delta, t)
omega = sqrt(k/m);
cC = 2*m*omega;
if c>= cC
disp('Not an underdamped system')
T = 0; x = 0;
return;
end
% end of if- - - - - - - - - - - - - - - - - - - - -
omegaD = omega*sqrt(1-(c/cC)^2);
T = 2*pi/omegaD;
x =delta*exp((-c.*t)/2*m).*(cos(omegaD*t)+c/(2*m*omegaD).*sin(omegaD*t));
end
% end of the function - - - - - - - - - - - - - - - -

Answer & Explanation Solved by verified expert
4.1 Ratings (754 Votes)
cilck on new symbol on top    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students