I'm just going to step through this, we did it once before for the triad. Let me make sure this is all initialized. So the setup is the same thing, we setup the truth. I'm setting softs and actual attitude, I'm getting, these are my known inertial directions, and then I'm mapping the inertial directions into the body frames. So these are my truth observations. And then I simply setup measured states which are slightly corrupted versions of that. So you can see truth would've been 813 something. I'm giving 819, I just manually made it. You can throw in random noise or something too. Yes, sir? >> What are the weaknesses of the Davenport Q Method? You said there was a different algorithm that applies in a lot of stuff. >> Okay, let's talk about that now. There's no singularity. This always works. It's a clear process. You do it in classic, this is the established algorithm to do vectors you will get four answers. One of them hopefully will be the big one, needs to be the big one, and you can do this. Where is the challenge? How much fun was it doing a three-by-three eigenvalue eigenvector by hand? The computer will do it, and it does it pretty quickly for a three by three. If you do this for a four by four, just time Matlab once. Do the timing operation. Do it on a general three by three you've randomly generated, then do it on a four by four. Then do it on the five by part. For every dimension extra, it's not just 10% more time. It's like a quantum jump in hour much time it takes to evaluate it. So the biggest challenge, especially many years ago when we weren't flying very fast processors in space, we were worried about radiation hardening. As well as with the latest Pentium chips that were flying, or Intel chips. You worry about computational effort. And solving a four by four eigenvalue eigenvector problem on a flight computer can be a big challenge to do this. So, when we get to the next method quest, they all solve problem, they give you the same answer to within numerical precision. The differences in all these research papers analysis is how fast I can get it. And the is a very fast one. There's one that's called ESOQ, Dariele Morari did, ESOQ 1 and 2. He showed they're actually a little bit faster than they even. But there's lots of different formulations that have been done out there, and it's all about speed, how quickly we can get to this answer. So no, great question. So this was just a setup, right? Same as the triad. I'm not going to spend much time with this. In fact, it's the same corruption. That's why I didn't apply random numbers. I want to make sure I'm using the same corrupted measurements across all the different methods. So now, how do we do this. In this problem, I'm just saying look I'm setting the weights equal. So I'm not making any distinction into accuracy in one sense or to another. The triad just used one completely and kind of partially used the other. Here I'm going to use both equally in this measure. Now I go ahead and I go I evaluate this b matrix which you can see is a three by three. B plus the transpose gets you the s, the trace gets you sigma. Then I composed the z and in the end I put this all together. And you come up with a four by four, right? There's a homework problem that has you do exactly this stuff just with different measurements, different kinds of states. A little bit more challenges in there. So that's it. Now we've got my keg matrix. Next thing I do is I evaluate the mathematic that's called Igon's system. So here's my four Igon values that I have. So which one is the biggest? Clearly, this one. Plus 1.99. That's minus. And then it's 0.03 the first one is clearly the biggest. And, so, I am going to set my perconia set equal to the first eigenvector because that was the biggest one. And, the answer is already unit length. That's just what these algorithms happen to give us. Now, here, you can see the scalar part is positive. Which means this is actually the short rotation of that attitude measure. If this was flipped and you cared about it, you could simply reverse the sign of all four of them again, right. But that's how you find four possible ways. Now let's see how good it is in estimation. And if I know simply map this quarternine set into EP to C. Then mapping it to the direction cosine matrix, I get this direction cosine matrix and like with the triad method, we have the true attitude. That's how we set up this problem. I'm going to do b bar n transposed with b and true. That will give me b bar relative to b so that's the attitude of the estimated body frame relative to the true body frame. Where is that? And then I pull out the principal rotation angle and that's what I'm doing here. So, as expected the DCM of b of the estimated body relative to the true body is almost identity. Which was what we hoped for, right. If it were identity, it would be 0 estimation error. And you're really, really lucky. But, it should be something hopefully close to that. And then you pull out the added actual angle error and it's about 1.69 degrees. And if you compare the same math with the triad method. You may not remember it. But, that was somewhere I would have to evaluate all of those. 1.85, right. So, actually we did better which is nice. We used all of the first measurement and the second. So let's, I did better. That sounds great. Are you guaranteed that the triad will do worse than did Davenport's Q method, right? Davenport Q method has to work optimally in there. We're optimizing a cost function, and that's a great sales pitch when you're talking to sponsors and stuff. This one's going to be optimal. But be very careful, are you sure that optimal is better than triad? What do you think? >> Well, you chose the waits, so if you chose the wrong measurement to wait. Could be worst. Even LQR control people go, awe, it's optimal controlled. Yes, but it's with randomly human chosen weights. So, other weights may be do different things. That's one part of it. But, the other thing is you're using both parts. But, let's some some sensor you were using, it was perfect. But the magnetic field measurement wasn't quite perfect. But, maybe it was just imperfect in the in plane direction but it had the plane about right. In that case, the triad, I mean, it's with random numbers. This is unlikely but this could happen. So if you run lots of Monte Carlos, you may have a situation where the triad method uses all of this one that happens to be really, really good and part of this one, and using the parts that are good. The other parts we happen to ignore. It's mathematically possible for the triad method to give you an answer that's better than just optimal method. It's possible. Is it likely? No. [LAUGH] All right. If we run enough runs, that's a very we have to be very lucky in how these errors have lined up. But if you are running enough runs and if you're going a demo to a sponsor, the demo gods kick in, and you're very likely to have a random number that's going to give you something where try it is better. And you're trying to prove to the sponsor, hey, your cool new algorithm is better. Not necessarily. So, run it statistically. Run it a hundred times, a thousand times. That kind of stuff. This is where you get a good measure and you can show hey, statistically, Davenport should beat Triad but in any instance that may or may not be true. Okay, so good, so we did Davenport. Let's move onto the others. We want to wrap this up for sure here.