Write a MATLAB user-defined function that calculates and graphs the step respons
ID: 2084487 • Letter: W
Question
Explanation / Answer
The given MATLAB Function takes w(natural undamped frequency) and z(damping ratio) as it's inputs and produces the desired step response along with it's plot.
function response_step(w,z)
if z>=1 || z<=0
disp('Error! Please Enter the value of damping ratio between 0 and 1.');
end
if z>0 && z<1
t=0:0.001:10;
wd=w*sqrt(1-((z)^(2)));
zz=z/sqrt(1-((z)^(2)));
for i=1:length(t)
y1(i)=cos(wd*t(i));
y2(i)=zz*sin(wd*t(i));
y3(i)=exp(-z*w*t(i))*(y1(i)+y2(i));
y(i)=1-y3(i)
end
plot(t,y)
end
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.