Question: MATLAB HELP: I have this code but I need to plot different values of zeta on the same plot ( that's 4 lines on 1

MATLAB HELP:

I have this code but I need to plot different values of zeta on the same plot ( that's 4 lines on 1 plot)

i.e. zeta = 0.1,1,1.1,2

kindly help

The code works fine with just one value of zeta.

%1-DOF Spring Mass Damper Systems clc; close all; g = 9.81; Y0 = 0; V0 = 0; zeta = 0.1; wn = 2*pi*100; wd = wn*sqrt(abs(1-zeta^2)); A = Y0-(1/wn^2)*g; B = zeta*wn/wd*A+V0/wd; T = 3*2*pi/wn; t = linspace(0,T,300); if zeta < 1 Y = exp(-zeta*wn*t) .*(A*cos(wd*t)+B*sin(wd*t))+((1/wn^2)*g); end if zeta > 1 Y = exp(-zeta*wn*t) .*(A*cosh(wd*t)+B*sinh(wd*t))+((1/wn^2)*g); end if zeta == 1 Y = exp(-zeta*wn*t) .*A+exp(-wn*t) .*t*(V0+wn*A)+((1/wn^2)*g); end figure plot(t,Y); xlabel ( 'Time [sec] ' ); ylabel ( 'y [m]' ); title ( 'Vibration response '); grid on; hold all

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!