find overshoot, undershoot, rise time and fall time on a non step response function
61 views (last 30 days)
Show older comments
So i know i can do this with a step response plot
But say i have a continuous time doman plot aka just a vector of data
I want to find rise and fall time over shoot and undershoot
are there any built in functions for this?
2 Comments
Accepted Answer
Star Strider
on 14 Aug 2021
12 Comments
Star Strider
on 14 Aug 2021
Edited: Star Strider
on 15 Aug 2021
I wish you could share the data.
At least then I’d have some idea of what the problem is.
Well, at least the square wave possibility is no longer an option. I considered that when I realised tthat ‘fall time’ might be exactly that, rather than ‘settling time’ that I initially assumed (and that turned out to be correct).
Is the compare function giving any useful information as to how well the estimated system matches the data?
Perhaps simulating the input ‘u(t)’ if you have an idea of what it is, and giving that to iddata (and ssest) would make this easier. Also, experiment with the other arguments and name-value pair arguments to include delays and other options.
If you want to get a more general idea of the system characteristics, one possibility would be to take the fft of the signal. Plotting the imaginary part of the fft as a function of frequency would tell you how many poles and zeros there are, and approximately where they are, including those at the origin and infinity. Use the one-sided fft for this. The ssest function allows a range of orders that it can the experiment with, so that could be an option as well, however the imaginary fft plot would allow you to see them yourself and to see if it truly is a second-order system.
I doubt that tfest would provide any better estimate than ssest (since in my experience, ssest is the most robust option), however it could be worth trying. I have no idea what else to suggest at this point.
———
EDIT — (15 Aug 2021 at 14:48)
The only other approach I can suggest is to fit the data to a function using one of the nonlinear parameter estimation routines (fminsearch, lsqcurvefit, nlinfit, fitnlm, or others). That function derivation could be:
syms f(t) y(t) t p y0 Dy0 f0
p = sym('p',[1,2]);
Dy = diff(y);
D2y = diff(Dy);
Eqn = D2y + p(1)*Dy + p(2)*y == f0;
ys = dsolve(Eqn, Dy(0)==Dy0, y(0)==y0);
ys = simplify(expand(ys), 500);
yfcn = matlabFunction(ys, 'Vars',{[p(1),p(2),y0,Dy0,f0],t})
with ‘in1’ the parameter vector corresponding to (in order): [p(1),p(2),y0,Dy0,f0] .
A representative plot of that (with estimated parameters being simulated here) would likely be something like this:
figure
fplot(@(t)yfcn([1,1,0,0,1],t), [0 15])
grid
Then calculate the necessary characteristics from the estimated function.
.
More Answers (3)
Paul
on 14 Aug 2021
I'm not sure what you mean by "fall time," so can't help you there.
Why isn't
stepinfo(y,t)
sufficient? Is the data too noisy or something?
1 Comment
Paul
on 15 Aug 2021
I'm still not sure why stepinfo() isn't useful for your application.
As I understand the problem, you have some data and you wish to find some figures-of merit of the data. I'm still under the impression that the data is essentially the output of a system that was excited by a step input.
Why am I under that impression? Because:
a) the figures of merit overshoot, undershoot, and rise time are commonly used to describe the output of a system in response to a step input. I'm not familiar with "fall time" but a quick search suggests it's essentially the same as the rist time
b) this answer, which you seemed to be pursuing, suggested using the function stepinfo(), which is used to estimate the figures of merit you seek for the output of a system in response to a step input
Based on the above, I'm assuming you have some data that looks like a "typical 2nd order step response." For what I'm sure are good reasons, you can't show us the data. So let's create some
sys = tf(1,[1 2*.7 1]); % 2nd order system for experimenting
stepinfo(sys) % get the figures of merit based on the model
[y,t] = step(sys); % generate some data
stepinfo(y,t) % gneerate the same figures of merit based on data
As expected, the FOMs based on the data closely match what stepinfo caclulates based on the model.
Does this example capture the essence of what you're trying to do?
If not, you'd probably get more traction here if you posted an example of what you're trying to accomplish with some actual data. Not the real data in question if you can't share it, but some example data that sitll illustrates the problem.
Robert Scott
on 15 Aug 2021
1 Comment
Image Analyst
on 15 Aug 2021
How about this instead:
"Picture this -- see the screenshot below of my data plotted."
And then indicate with red lines or arrows exactly what x and y distances you want to measure between.
Robert Scott
on 15 Aug 2021
1 Comment
Star Strider
on 15 Aug 2021
Just out of curiosity, what were you able to do with Python that you could not do with MATLAB?
I am still not certain what the problem is with the data. If it is noisy, one option could be the Savitzky-Golay filter sgolayfilt function that generally works and is preferable for broadband noise where frequency-selective filters completely fail. (Select 3 for the order, then experiment with the frame length to get the best result.) The smoothdata function can slso use it, however it is apparently necessary to have the Signal Processing Toolbox to use it with smoothdata.
.
See Also
Categories
Find more on Transfer Function Models in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!