From: Justme on 2 Jul 2010 14:15 > So if we were to have yaw values: > > yaw = [359 360 361] > > Do you want the results to be: > > adjustedYaw = [359 360 359] % "reflected" at 360 -- going "back down the > scale"? > > or: > > adjustedYaw = [359 0 1] % angle mod 360 > > In the latter case, you might want to look at the UNWRAP function. > > -- > Steve Lord > slord(a)mathworks.com > comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ > To contact Technical Support use the Contact Us link on > http://www.mathworks.com Thanks for the quick replies guys. Steven, I was looking at the former actually. > Do you want the results to be: > > adjustedYaw = [359 360 359] % "reflected" at 360 -- going "back down the > scale"? I was playing around with the mod command as dpb suggested, trying to get a feel of the function. He is right, I am starting to understand what the function does alot and that is exactly what i'm going for. Hopefully I am not veering too far off topic but I am only calculating for one parameter, yaw. Not x,y,z so I am unsure if I really need to take into account the angles...but I suppose it would not hurt for "extra credit?" For now, I only am trying to scale back down or scale up depending on if i'm at 360 or -360.
From: Justme on 2 Jul 2010 14:48 Sorry..having some internet trouble..hope this doesn't double post. So I think I made some headway... Within my script I have these two functions %interpolate interpme=interp1(time1, yaw1, time2); %performance perform_data = abs(yaw2-flight_interp); I merely changed them to this... %interpolate interpme=interp1(time1, mod(yaw1,360), time2); %performance perform_data = abs(mod(yaw2,360)-flight_interp); Now, I believe my only "problem" is that doing the modulo this way, starts my points back to zero, once it hits 360...but both dpb and yourself, stephen are right in suggesting that I want it to actually scale down from 360...
From: Nathan on 2 Jul 2010 14:57 On Jul 2, 11:48 am, "Justme " <sa...(a)aol.com> wrote: > Sorry..having some internet trouble..hope this doesn't double post. > > So I think I made some headway... > > Within my script I have these two functions > > %interpolate > interpme=interp1(time1, yaw1, time2); > > %performance > perform_data = abs(yaw2-flight_interp); > > I merely changed them to this... > > %interpolate > interpme=interp1(time1, mod(yaw1,360), time2); > > %performance > perform_data = abs(mod(yaw2,360)-flight_interp); > > Now, I believe my only "problem" is that doing the modulo this way, starts my points back to zero, once it hits 360...but both dpb and yourself, stephen are right in suggesting that I want it to actually scale down from 360.... if (yaw1> 360) %note, this will work for 359 < yaw1 < 720 tmpyaw1 = 360-mod(yaw1,360) else tmpyaw1 = yaw1 end %interpolate interpme=interp1(time1, tmpyaw1, time2); %and similar structure for yaw2 Hope this helps -Nathan
First
|
Prev
|
Pages: 1 2 Prev: Spliting a matrix of NaN's and not NaN's Next: Image Acquisition Toolbox and DCAM on win64 |