Create plots for the second-order control system, in the same figure, given by the following expression for different values of the damping ratioč (zeta), 1 y = 1-- "sin( – 5°x + cos"(5) Use five different values for 6; 0.1, 0.2, 0.4, 0.7, 0.9. Also, ask user to enter vector x that represents range (x-axis) over which plots will be created. Sample Output y = 1-(16(1-53))o%sin(v(1<3)x+cos'x) 1.8 5 =0.1 5 =0.2 5 =0.4 5 = 0.7 5 =0.9 1.6 1.4 1.2 0.8 0.6 0.4 0.2 4. 6. 10 12 14 x in radians 1. (x)A


Matlab code:
clc;
%input from user
x = input('Enter 5 max range value for each zeta plot, in the form [x,x,x,x,x]:');
%creating vector range from user input
x1=0:0.01:x(1);
zeta = 0.1; %assigning zeta value
%equation of the system
y=1-(1/sqrt(1-(zeta^2))).*exp(-zeta*x1).*sin((sqrt(1-(zeta^2))*x1)+(acos(zeta)));
plot(x1,y); %plotting y(x1)
hold on; %holding on to plot other wave on same graph
%creating vector range from user input
x2=0:0.01:x(2);
zeta = 0.2; %assigning zeta value
y=1-(1/sqrt(1-(zeta^2))).*exp(-zeta*x2).*sin((sqrt(1-(zeta^2))*x2)+(acos(zeta)));
plot(x2,y); %plotting y(x2)
hold on;
%creating vector range from user input
x3=0:0.01:x(3);
zeta = 0.4; %assigning zeta value
y=1-(1/sqrt(1-(zeta^2))).*exp(-zeta*x3).*sin((sqrt(1-(zeta^2))*x3)+(acos(zeta)));
plot(x3,y); %plotting y(x3)
hold on;
%creating vector range from user input
x4=0:0.01:x(4);
zeta = 0.7; %assigning zeta value
y=1-(1/sqrt(1-(zeta^2))).*exp(-zeta*x4).*sin((sqrt(1-(zeta^2))*x4)+(acos(zeta)));
plot(x4,y); %plotting y(x4)
hold on;
%creating vector range from user input
x5=0:0.01:x(5);
zeta = 0.9; %assigning zeta value
y=1-(1/sqrt(1-(zeta^2))).*exp(-zeta*x5).*sin((sqrt(1-(zeta^2))*x5)+(acos(zeta)));
plot(x5,y); %plotting y(x5)
hold on;
legend('zeta=0.1','zeta=0.2','zeta=0.4','zeta=0.7','zeta=0.9');
title("second order control system");
xlabel("x in radians"); %labelling x axis
ylabel ("y(x)"); %labelling y axis
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images









