As you didn't provide sufficient explanations for the problem and I don't know what it is, so I just integrated the given differential equation in the blue NDO Fcn block as usual, and this is the simplest example I can make with the disturbance :
No worries, @ALABA PHILIP OPAYEMI. I'm no UAV expert but I guess you got confused by the symbol z in UAV dynamics with another symbol z in the NDO , where the former refers to altitude (layman's terms: height of the UAV above ground), and the latter refers to internal state of the NDO in estimating the disturbance. So, pick your symbols wisely during coding.
Anyhow, I think my example should be simple enough for you to follow. In my example, I made , , and . Just type out the right-hand side of your NDO differential equation in the blue Fcn block (or multiple Fcn blocks if NDO order is higher than 1) and hook it up to an Integrator block (or corresponding Integrator blocks) with the intial condition with .
Also, since I assumed in my example, then naturally , where I labelled the signal as dhat. In your case, you should probably multiply the sum with the matrix .
If you find my simple NDO demo example in Simulink is helpful, please consider accepting ✔ and voting 👍 the Answer. Thanks!
Actually I copied the Fcn block from the old versions of a Simulink file. Also, Fcn handles only a single scalar equation. In my NDO Fcn block, I have shown the equation that I entered in the block:
- 10*1*u(3) - 10*(1*10*u(2) + 0 + 1*u(1))
where u(1) refers to the u input, u(2) refers to the x input, and u(3) refers to the input.
Since your NDO order is 2, then you will need two Interpreted MATLAB Function blocks plus two Integrator blocks to get the internal states and . Of course, you also need to do a little math to resolve the NDO matrix equation form () into two NDO scalar equations ( and ).
Else, if you are relatively good and comfortable at coding, you can use the S-Function block directly. S refers to System, and since the NDO is a system described by the differential equation, then it is 100% possible to write the compact NDO matrix equation form () in the S-function.
The S-function approach is generally preferred and more efficient for higher order systems ().
Please help me check, this is the result I am getting when I simulate disturbance d and its estimatimation dhat. I do not know the reason for the gap between d and dhat?
Technically, it looks like you have successfully estimated the disturbance, but with an offset of . What could that be? I can't determine from the image of a block diagram. My mathematical instinct tells me it probably comes from the input u if it has a constant term.
By the way, I noticed this circled in RED. Maybe this is the culprit.
Old stuff:
I don't know what your control input u is. But if it is some kind of simple mathematics, then I think you can check and find out of whether or not there is a constant in u.
Do not fret about it! As mentioned previously, your NDO has successfully estimated the amplitude and frequency of the sinusoidal disturbance. A workaround for this is simply add back to , something like
Thank you @Sam Chak, my main challenge is how to implement this for simulation as I want to model wind disturbance for a quadrotor. These are my concerns:
how to get DCM for a Quadrotor?
what Airspeed input to use, as I am performing a simulation and no means to measure airspeed?
I will appreciate if you can put me through on this...
@ALABA PHILIP OPAYEMI, Thanks for your clarification. Looks like this is beyond NDO. NDO is simply pure math, just a single line of equation. But your new questions are Engineering and Physics problems. It's not even a MATLAB/Simulink problem.
Can you find out the DCM formula for your Quadrotor?
When I say it's Physics, it's because I think we need to imagine what the Airspeed is defined according to the Aerodynamics. I presume that you are Aeronautical Engineering Guy based on the project you did above (correct me if I'm wrong). Sure this is only simulation and you cannot measure the real Airspeed. But you can definitely estimate them (via mathematical formula) from the states of your Quadrotor.
MathWorks Help Center Search results show that there are blocks in the Aerospace Blockset for you to compute and obtain the DCM. See link:
If you don't have the Blockset, you can write the code to compute DCM. I've checked with a lecturer in the Department of Mechanical & Aerospace Engineering. DCM is commonly taught in Flight Dynamics and Control, or Motion of Mechanical Systems.
Stay calm because the challenge is not as big as you think. Do 1 thing at at a time. I'd suggest that your put the Simulink simulation on hold. Sort out the mathematical formulas that you need to compute the Quadrotor DCM and Airspeed. If you still needs help, then ask a new question on how to put those formulas in the Simulink Block.
I have tried to incorporate the DCM and other necessary input parameters into the model but did not work. I am yet to understand how to implement it...
However, I have been using this model(https://www.mathworks.com/help/simulink/slref/aircraft-longitudinal-flight-control.html) below and it works; except that I do not know how to vary the parameter to get different desired wind speeds as I am yet to come accross any documentation on it.
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.