Тёмный

4 Ways to Implement a Transfer Function in Code | Control Systems in Practice 

MATLAB
Подписаться 518 тыс.
Просмотров 64 тыс.
50% 1

Check out the other videos in the series:
Part 1 - What Does a Controls Engineer Do? • What Control Systems E...
Part 2 - What Is Gain Scheduling? • What Is Gain Schedulin...
Part 3 - What Is Feedforward Control? • What Is Feedforward Co...
Part 4 - Why Time Delay Matters • Why Time Delay Matters...
Part 5 - A Better Way to Think About a Notch Filter • A Better Way to Think ...
Part 6 - What are Non-Minimum Phase Systems? • What Are Non-Minimum P...
In some situations, it is easier to design a controller or a filter using continuous, s-domain transfer functions. We have a lot of mathematical tools that make analyzing and manipulating them easier than, say, their equivalent time-domain differential equations. However, while we like to work with transfer functions for design and analysis, it’s often the case that we need to implement them in software that runs on some processor or microcontroller, and it might not be obvious how to go about doing this. So, in this video we’ll cover four simple ways to implement a transfer function in code.
Check out these other links:
- Download the code from the video, tfcodemethods.mlx: github.com/aerojunkie/control...
- A playlist on discrete control. It describes how we go from the s-domain to the z-domain and the 5th video specifically describes why the Tustin method is equivalent to trapezoidal integration: • Discrete Control
- Introduction to State Space: • Introduction to State-...
- Introduction to Embedded Coder: bit.ly/37KYGsh
--------------------------------------------------------------------------------------------------------
Get a free product trial: goo.gl/ZHFb5u
Learn more about MATLAB: goo.gl/8QV7ZZ
Learn more about Simulink: goo.gl/nqnbLe
See what's new in MATLAB and Simulink: goo.gl/pgGtod
© 2019 The MathWorks, Inc. MATLAB and Simulink are registered
trademarks of The MathWorks, Inc.
See www.mathworks.com/trademarks for a list of additional trademarks. Other product or brand names may be trademarks or registered trademarks of their respective holders.

Наука

Опубликовано:

 

3 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 45   
@varunmamtani2324
@varunmamtani2324 3 года назад
Easily the best tutorials I have found on the internet of anything really. Great work!
@dunzhichen4132
@dunzhichen4132 Месяц назад
Exactly what I am looking for! ❤
@entropyz5242
@entropyz5242 4 года назад
Hello Brian, I just wanted to say that your videos have helped me so much in my control systems classes. I started watching your videos in my Linear Controls Systems I class at USC with Dr. Henryk Flashner; I just recently discovered that you attended this university as well. Watching your videos has given me a different perspective on control theory that has helped me comprehend it very well. You are truly and inspiration to me and to many of my classmates in the control systems field. Thank you so much for sharing your knowledge 🙏
@BrianBDouglas
@BrianBDouglas 4 года назад
Erick Zamora I took a few classes with Dr. Flashner! Thanks for the kind comment. Best of luck with everything!
@Amine-gz7gq
@Amine-gz7gq 2 месяца назад
No one teaches control theory better than Brian Douglas
@StefanBrock_PL
@StefanBrock_PL 4 года назад
Very clear presentation. Thanks. IMHO this are 3 metods and 1 trick.
@Debraj1978
@Debraj1978 2 года назад
Though state space implementation may seem better, since it uses just one integration per iteration, but while implementing the code on embedded controller "C" code, you will have to do matrix multiplication, which will take many cycles. In my opinion, converting to "z" transform is the best and most popular method.
@MrLeocars97
@MrLeocars97 Год назад
Indeed. However, matrix manipulation can be made easy if you are able to port Eigen (C matrix library) into your hardware ;)
@user-qp4gs4ky8h
@user-qp4gs4ky8h 4 года назад
A wonderful explanation! Thank you very much!
@WolfixDwell
@WolfixDwell Год назад
Thank you for putting out nicely structured knowledge for everyone to grab and understand. Helped me with work-related thing.
@mnada72
@mnada72 3 года назад
I am a big fan of you Brian I come here after watching all the videos on your channel . I think your channel and followed by your videos here are a great reference for studying control What text book you recommend for studying control and a road map for how to be confident of control like you. My respect for your contribution to control engineering community.
@peter_jpw
@peter_jpw 2 года назад
I'd suggest as a default initializing previous-step signals to their current measured values. If someone is implementing a compensator or a filter, this would give the expected behavior, vs. initializing to zero which may give "spikes" or "jumps" upon startup.
@xursssulaxx
@xursssulaxx Год назад
thank you so much for these videos showing the matlab code. super helpful
@felixruiztorrez5192
@felixruiztorrez5192 3 года назад
Super video! Thank you!
@kameelamareen
@kameelamareen 4 года назад
Cant thank you enough man !
@vihangpathak9759
@vihangpathak9759 4 года назад
Thank you so much Brian
@MrLeocars97
@MrLeocars97 4 года назад
Amazing! Thank you Brain!
@gastonmelo6473
@gastonmelo6473 4 года назад
Clear as cristal
@nitinkmaurya
@nitinkmaurya Год назад
Crystal*
@vespulavulgaris8069
@vespulavulgaris8069 3 года назад
Thank you so much!
@babakkhaleghiborna7027
@babakkhaleghiborna7027 Год назад
You are brilliant, thanks a lot 🙏 🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏
@Tupiniviking_de_osasco
@Tupiniviking_de_osasco 4 года назад
Amazing as always! One question: what tools do you use to make your videos?
@JKTCGMV13
@JKTCGMV13 4 года назад
Another episode! Writing the code is one thing that confused me the most.
@keithfife2355
@keithfife2355 11 месяцев назад
All of these methods essentially numerically solve the resulting ODE from the transfer function, what is the feasibility or other practical considerations for using a running convolution with a stored step response? Of course since a stored step response is necessarily finite in length it would only actually perform FIR filtering, but they can be made arbitrarily close to IIR filters.
@JamesTJoseph
@JamesTJoseph Год назад
I am trying it in Julia ☺️
@gpcm
@gpcm 4 года назад
I wish I could like this video twice
@steeltitan8683
@steeltitan8683 2 года назад
You can do that actually! iykwim :D
@Supreme0084
@Supreme0084 4 года назад
Could you please make a video about the Nichols Chart and how to use it in designing phase lead/lag controllers.
@mehmetkilic9518
@mehmetkilic9518 4 года назад
Will you add also State-space discretization as an extra method?
@user-os7kc3gv3z
@user-os7kc3gv3z 10 месяцев назад
Hi Brian, quick question. How did coefficient in denominator of discretized function with z^-1 member switched from 1.99 to 1.9899 when code was written
@kebabsharif9627
@kebabsharif9627 2 года назад
What if the input signal in a Sawtooth form and the TF has and derivative componet i mean a zero in the origin ?
@blazepascal1878
@blazepascal1878 2 года назад
What would be the changes to this process if the system was MISO?
@saidburakguzel
@saidburakguzel 4 года назад
what if we have a higher than 2nd order transfer function? Also, how we can use the code that matlab generate, i couldn't find any input and output setion, its so complicated code, can you provide information or a link about this, thank you for your great video!!
@BrianBDouglas
@BrianBDouglas 4 года назад
The process is the same for higher than 2nd order transfer functions. You just will have to initialize more states at the beginning. For the state space method (easiest to explain), your state vector would have more elements in it but the code would still just have that single integrator. The auto code is complicated because there is a lot more going on than just the transfer function code. There is all of the stuff that runs the simulation and execution part of it as well (steps, timers, memory allocation, etc.). I don't have the code in front of me right now, but if you look through the file you should be able to find the portion where the transfer function is written out. Let me know if you can't figure it out in a bit and I'll try to help a bit more.
@saidburakguzel
@saidburakguzel 4 года назад
@@BrianBDouglas As a user, i would like to put the generated code directly into the microprocessor, but anyway MATLAB still doing well jop. I've reviewed the generated code in general and found some input, output, and useful definitions that you mentioned, but there are still lots of parts that need to be edited. i guess i rather use state-space arrays. I also watched a lot of your videos including state space, these are quite good and I would recommend it to anyone who working on it. Thank you for your help and interest :)
@steeltitan8683
@steeltitan8683 2 года назад
@@BrianBDouglas Sir, thank you for awesome lectures. I want to discritize a lead-lag controller for a microcontroller. I used the z-transform method you discussed, to get the time-domain coefficients and implemented the similar equations as you did (three delay terms in my case). The discrete controller's response is excellent when I plot using step(continuous, discrete) function. But it flies off to infinity when I do with difference equations as you did. Is it due to rounding error accumulating over time? I can't find a way around :(
@steeltitan8683
@steeltitan8683 2 года назад
Yes! Solved it! Using tfdata, I imported the coefficients of the discretized function. Then I used vpa to get the precise value of coefficients up to ten decimal places. It did the trick!
@fernando.liozzi.41878
@fernando.liozzi.41878 4 года назад
Hi, thanks!, ydd=ud+2u-yd-(2)y. Is it possible that you forgot 2 in 5:39? Regards.
@BrianBDouglas
@BrianBDouglas 4 года назад
Fernando Liozzi yep, great catch. I can’t believe I left that off. Thanks for letting me know.
@mehmetkilic9518
@mehmetkilic9518 3 года назад
Hello Brian, I have used the third method for implementing a fourth-order transfer function without zeros [6810.43913975331 / (s^4 + 36.3373933727534s^3 + 495.152308922335s^2 + 2998.75737145633s + 6810.43913975331)]. I tested the resulting discrete method(Tustin, 0.005 s) and the corresponding continuous transfer function in simulation both results matched BUT I got little oscillatory behaviour response with a bias on the discrete transfer function response when I run them in real-time with ardunio support package. I couldn't find the reason. Can you give me a little help with that?
@mehmetkilic9518
@mehmetkilic9518 3 года назад
Be aware of the precision of transfer function coefficients. Do float or double can give you enough precision? Check it :)
@minghuiou9357
@minghuiou9357 Год назад
The discrete time system is nonminimum phase, need to consider how to make it minimum phase……
@mervynlarrier9424
@mervynlarrier9424 8 месяцев назад
Why does the first method accrue error over time?
@BrianBDouglas
@BrianBDouglas 8 месяцев назад
It comes from the numerical integration and differentiation. Instead of taking a continuous integral, we're using a first order method to sum the area under the curve and this isn't perfect. The faster the sample time the more accurate it is, but error will still accumulate. This is actually a problem with all of the methods. Better accuracy comes from solving fewer numerical integrations or increasing the order of the numerical integrator.
@alexandrpetrov1110
@alexandrpetrov1110 3 года назад
Thank you so much Brian
Далее
Understanding the Z-Transform
19:56
Просмотров 94 тыс.
Water powered timers hidden in public restrooms
13:12
Просмотров 705 тыс.
A real control system - how to start designing
26:58
Просмотров 263 тыс.
System Identification Methods
17:27
Просмотров 132 тыс.
Проверил, как вам?
0:58
Просмотров 272 тыс.
Чем нельзя протирать экран?
0:44