How to plot the “Response” and the “damping exponential function of the transient solution” on the same figure?

6 views (last 30 days)
how to plot the exponential curve like this pucture on the same figure ?
I have done this part of the code
-------
clear all;close all;
clc;
xss=0.01;
wf=40;
wn=20;
zeta=0.1;
A=0.1; B=0.04;
wd=wn*sqrt(1-zeta^2);
t=0:0.005:4;
X=xss*cos(wf*t)+(A*sin(wd*t)+B*cos(wd*t)).*exp(-zeta*wn*t);
plot(t,X,'r','LineWidth',2)
grid on
and i got this
------
i need it like this

Answers (1)

Mathieu NOE
Mathieu NOE on 6 Apr 2021
hello
If you have the Signal Processing Tbx, envelope was made for you
clear all;close all;
clc;
xss=0.01;
wf=40;
wn=20;
zeta=0.1;
A=0.1; B=0.04;
wd=wn*sqrt(1-zeta^2);
t=0:0.005:4;
X=xss*cos(wf*t)+(A*sin(wd*t)+B*cos(wd*t)).*exp(-zeta*wn*t);
plot(t,X,'r','LineWidth',2)
grid on
envelope(X, 100, 'peak')

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!