زكسوس المتوسط المتحرك


معالجة الإشارات كونفولوتيون كونفولوتيون 8212 منفصلة 1-D التفاف. conf2 8212 منفصلة 2-D التفاف. convol2d 8212 منفصلة 2-D التفاف، وذلك باستخدام ففت. المراسل 8212 الارتباط، التغاير هانك 8212 التغاير إلى مصفوفة هانكيل xcorr 8212 يحسب السيارات منفصلة أو ارتباط عبر الفلاتر analpf 8212 إنشاء التناظرية المنخفضة تمرير مرشح buttmag نقل 8212 قوة شلال تحقيق بتروورث مرشح CASC 8212 مرشح من معاملات cheb1mag 8212 استجابة من نوع تشيبيشيف 1 فلتر cheb2mag 8212 استجابة من نوع 2 تشيبيشيف مرشح convol 8212 الإلتواء ell1mag 8212 حجم بيضاوي الشكل مرشح eqfir 8212 مينيماكس تقريب مرشح FIR eqiir 8212 تصميم مرشحات آي آي آر faurre 8212 مرشح حساب من قبل بسيطة ffilt خوارزمية Faurre 8212 معاملات FIR تمرير منخفض filtsinc 8212 عينات من مرشح وظيفة المصفوفة 8212 مرشحات تسلسل البيانات باستخدام مرشح الرقمية فيندفريق 8212 المعلمة التوافق لتصميم مرشحي بيضاوي الشكل فرماغ 8212 حجم مرشحات الأشعة تحت الحمراء ومرشحات إير فسفيرلين 8212 تصميم فير، مرشحات المرحلة الخطية، مجموعة تقنية أخذ العينات تردد 8212 مجموعة تأخير للمرشح الرقمي هيلبرت 8212 منفصلة التحليلات الوقت إشارة حساب إشارة حقيقية باستخدام هلبرت تحويل إير 8212 إير فلتر رقمي إيرغروب 8212 مجموعة تأخير لب إير تصفية الأمثل إيرلب 8212 لب إير تصفية الأمثل كالم 8212 كالمان تحديث ليف 8212 معادلات يول ووكر (Levinson0039s خوارزمية) ليفين 8212 توبلتز نظام حلالا من قبل ليفينسون خوارزمية (متعدد الأبعاد) ليندكيست 8212 Lindquist0039s خوارزمية ريميز 8212 ريميز إكسهانج خوارزمية لتقريب تشيبيشيف المرجح من وظيفة مستمرة مع مجموع من جيب التمام. ريميزب 8212 مينيماكس التقريب من حجم استجابة سرفور 8212 جذر مربع جذر سركف 8212 الجذر التربيعي كلمان مرشح سكف 8212 ثابت الحالة تصفية كلمان سيريدي 8212 تصميم مرشحات إير، سيريدي رمز نظام واجهة 8212 مراقبة تحديث ترانز 8212 تمرير منخفض إلى تصفية أخرى تحويل وفير 8212 الخطي المرحلة مرشحات الأشعة تحت الحمراء وفيرغوي 8212 واجهة المستخدم الرسومية التي يمكن استخدامها لتصميم تفاعلي مرشحات وفير ويينر 8212 ويينر تقدير ويغنر 8212 0039time-Frequency0039 وينر الطيف نافذة 8212 حساب متماثل نافذة من نوع مختلف يوليوالك 8212 أقل مربع تصميم فلتر زبوت 8212 بوترورث التناظرية تصفية zpch1 8212 تشيبيشيف فلتر التناظرية zpch2 8212 تشيبيشيف فلتر التناظرية زبيل 8212 لوباس فلتر بيضاوي الشكل كيفية تصميم فلتر بيضاوي الشكل 8212 كيفية تصميم مرشح بيضاوي الشكل (التناظرية والرقمية) تحديد استجابة التردد فرفيت 8212 تناسب لاتن 8212 حل عودية من المعادلات العادية لاتب 8212 تحديد ما جزء من عملية أرما ناقلات mrfit 8212 استجابة التردد مناسبا للرعاية الصحية الأولية 8212 ماركوف تمثيل rpem 8212 تكراري-خطأ التنبؤ تقليل تقدير متنوعة BILT 8212 المترابط أو المعادلة الرباعية تحويل نظام SISO التي قدمها تمثيل zeropoles sincd 8212 وظيفة سينك الرقمية أو ديريتشليت نواة الطيفي تقدير cepstrum 8212 cepstrum حساب cspect 8212 اثنين عبر الوجهين تقدير طيفي بين إشارتين زمنيتين منفصلتين باستعمال طريقة الارتباط تشت 8212 خوارزمية تشرب z-إنفورم إنتديك 8212 تغير معدل أخذ العينات لإشارة ميس 8212 أقصى تقدير طيفي للأنتروبيا بسبكت 8212 تقديران طيفي عمودي جانبي بين إشارتين زمنيتين منفصلتين باستخدام متوسط ​​Welch0039s طريقة بيريوديوغرام. يحول إدت 8212 معكوس منفصلة جيب التمام تحويل. إدست 8212 تحويل جيبية منفصلة معكوس. إفت 8212 عكس فورييه تحويل فورييه. fft2 8212 ثنائي البعد سريع تحويل فورييه ففتشيفت 8212 إعادة ترتيب الناتج ففت، وتحريك تردد الصفر إلى مركز الطيف هيلب 8212 تقريب فير إلى مرشح تحويل هيلبرت إفتشيفت 8212 عكس ففتشيفت ديتريند 8212 إزالة ثابت، الخطية أو بييسويس الاتجاه الخطي من (c) 2011-2012 (إنريا) حقوق الطبع والنشر (ج) 1989-2007 (إنيك) مع المساهمين آخر تحديث: ويد جون 15 08:27:37 سيست 2016 معالجة الإشارات الرقمية المواد دسب معلومات مرجعية مصطلحات تصفية الرقمية من: رغ ليون، فهم الإشارات الرقمية المعالجة. (الملحق F - الصفحات 494-505). كوبي 1997 بي أديسون ويسلي لونغمان Inc. مستنسخ بإذن من أديسون ويسلي لونغمان. كل الحقوق محفوظة. الخطوة الأولى في التعرف على المرشحات الرقمية هي تعلم التحدث باللغة المستخدمة في أعمال التصفية. لحسن الحظ، المفردات من المرشحات الرقمية يتوافق بشكل جيد مع اللغة الأم المستخدمة لمرشحات (التناظرية) المستمر 151so نحن لا يجب أن نزيل أي شيء أننا نعرف بالفعل. هذه المادة هي مقدمة لمصطلحات المرشحات الرقمية. مرشاح ألباس - مرشح إير الذي استجابته للوحدة على مدى تردده بأكمله، ولكن استجابة مرحلته متغيرة. وعادة ما يتم إلحاق مرشحات ألباس بترتيب سلسلة بعد مرشح إير القياسي، H1 (z)، كما هو مبين في الشكل F-1. الشكل F-1 الاستخدام النموذجي لمرشح الالتفافية. ويمكن تصميم مرشح الالتفافية، هاب (z)، بحيث تعوض الاستجابة للطور، أو تساوي. استجابة المرحلة اللاخطية لمرشح إير الأصلي. 1-3 وهكذا تكون استجابة الطور للمرشح المجمع، هكومبيند (z)، أكثر خطية من H1 الأصلي (z)، وهذا أمر مرغوب فيه بشكل خاص في أنظمة الاتصالات. وفي هذا السياق، يسمى أحيانا مرشح الالتفافية معادل الطور. التوهين - خسارة الاتساع، التي تقاس عادة بالديسيبل، والتي تتكبدها إشارة بعد مرورها عبر مرشح رقمي. ويكون توهين الفلتر هو النسبة، عند تردد معين، لاتساع الإشارة عند خرج المرشاح على اتساع الإشارة عند دخل المرشاح، المعرف على أنه كما هو الحال عادة، بالنسبة لتردد معين، فإن اتساع خرج مرشح أصغر من السعة الإدخال، مما يجعل نسبة في إق. (F-1) أقل من واحد ويكون التوهين رقما سالبا. باند ريجيكت فيلتر - مرشح يرفض (يخفف) نطاق تردد واحد ويمر كل من نطاق تردد أقل وأعلى. ويوضح الشكل F-2 (a) استجابة التردد لمرشاح رفض التردد المثالي. ويسمى هذا النوع من الفلتر أحيانا مرشح الشق. الشكل F-2 مرشحات المرشحات واستجابات الترددات: (أ) مرشاح ترفض النطاق (ب) مرشح النطاق العريض. مرشح الموجة العريضة - مرشح، كما هو مبين في الشكل F-2 (b)، الذي يمر نطاق تردد واحد ويخفف الترددات فوق وتحت هذا النطاق. عرض النطاق الترددي - بعض المصطلحات في معالجة الإشارات لديها تعريفات أكثر من هذا واحد. تحديد عرض النطاق الترددي جيدا كما عرض تردد من نطاق التمرير من مرشح. وبالنسبة لمرشاح تمرير منخفض، يساوي عرض النطاق الترددي تردد القطع. وبالنسبة لمرشاح ممر الموجة، يعرف عرض النطاق عادة بأنه فرق التردد بين النقاط العليا والسفلى دب 3-. بيسل فونكتيون - وظيفة رياضية تستخدم لإنتاج استجابة الطور الأكثر خطية من جميع مرشحات إير دون مراعاة لاستجابة حجم التردد. على وجه التحديد، تصاميم المرشحات على أساس وظائف بسل لها تأخير مجموعة ثابتة إلى أقصى حد. (النمذجة بسل وظائف مع برامج الكمبيوتر، لا ينصح لضعاف القلب، عموما يؤدي إلى درسا كبيرا في التواضع.) بوترورث وظيفة - وظيفة رياضية تستخدم لإنتاج أقصى قدر من ردود مسطحة مرشح حجم دون النظر في خطي المرحلة أو مجموعة تأخير الاختلافات . التصاميم مرشح على أساس وظيفة بوترورث لا تموج السعة في أي من النطاق التمريدي أو وقف. لسوء الحظ، لترشيح مرشح معين، تصاميم باترورث لديها أوسع منطقة انتقالية من وظائف تصميم مرشح الأكثر شعبية. مرشحات متتالية - تنفيذ نظام تصفية حيث يتم توصيل عدة فلاتر فردية في سلسلة. وهذا يعني أن إخراج مرشح واحد يحرك مدخل الفلتر التالي كما هو مبين في الشكل F-1. تردد المركز (فو) - التردد الذي يقع عند منتصف مرشاح ممر الموجة. ويظهر الشكل F-2 (b) التردد المركزي للتردد المركزي لمرشاح ممر الموجة. وظيفة تشيبيشيف - وهي وظيفة رياضية تستخدم لإنتاج باسباند، أو ستوباند، تموجات مقيدة ضمن حدود ثابتة. هناك أسر من وظائف تشيبيشيف استنادا إلى كمية تموج مثل 1 ديسيبل، 2 ديسيبل، و 3 ديسيبل من تموج. يمكن تصميم مرشحات تشيبيشيف أن يكون لها استجابة التردد مع التموجات في نطاق التمرير و باسيباندس مسطحة (تشيبيشيف نوع I)، أو ممرات مسطحة وتموجات في ستوباند (تشيبيشيف نوع الثاني). مرشحات تشيبيشيف لا يمكن أن يكون تموجات في كل من النطاق التمريدي ونطاق التوقف. المرشحات الرقمية على أساس وظائف تشيبيشيف يكون أكثر انحدارا المنطقة الانتقالية لفة قبالة ولكن المزيد من خصائص الاستجابة المرحلة غير الخطية من، على سبيل المثال، مرشحات بتروورث. المعاملات - انظر عوامل التصفية. تردد قطع - تردد باسباند العلوي للمرشحات تمريرة منخفضة، وانخفاض تردد باسباند للمرشحات هيباس. ويحدد تردد القطع بمقدار النقطة دب 3- لاستجابة حجم المرشاح بالنسبة لقيمة نطاق التمرير الذروة. ويوضح الشكل F-3 تردد قطع التيار المتردد لمرشاح تمرير منخفض. الشكل F-3 استجابة الترددات المنخفضة للتردد الرقمي. السعة النسبية للنطاق ستباند هي -20 ديسيبل. ديسيبل (ديسيبل) - وحدة لوغاريتمي للتوهين، أو كسب، تستخدم للتعبير عن الجهد النسبي أو القدرة بين إشارتين. وبالنسبة للمرشحات، نستخدم الديسيبل للإشارة إلى ترددات القطع (دب 3-) ومستويات إشارة النطاق النقطي (دب 20) كما هو مبين في الشكل F-3. مرشح التصفية - مرشح تمرير رقمي منخفض تمرير معدل عينة الإخراج فيه أقل من معدل عينة إدخال المرشحات. لتجنب مشاكل التعرج يجب ألا ينتهك معدل عينة الإخراج معايير نيكويست. التصفية الرقمية - العملية الحسابية، أو الخوارزمية، وتحويل تسلسل منفصل من الأرقام (المدخلات) إلى تسلسل منفصل آخر من الأرقام (الإخراج) وجود طيف مجال التردد المعدل. يمكن أن يكون التصفية الرقمية في شكل روتين البرمجيات التي تعمل على البيانات المخزنة في ذاكرة الكمبيوتر أو يمكن تنفيذها مع الأجهزة الرقمية المخصصة. وظيفة البيضاوي - وظيفة رياضية تستخدم لإنتاج أكبر لفة قبالة لعدد معين من الصنابير مرشح. ومع ذلك، مرشحات مصممة باستخدام وظائف بيضاوي الشكل، وتسمى أيضا مرشحات كاور. لديها أفقر مرحلة الخطي من وظائف تصميم فلتر إير الأكثر شيوعا. ويكون التموج في نطاق التمرير ونطاق التوقف مساويا للمرشحات الإهليلجية. تأجيل المغلف - انظر تأخر المجموعة. معاملات الفلتر - مجموعة الثوابت، وتسمى أيضا الأوزان الصنبور. تستخدم في مضاعفة قيم عينة الإشارة المتأخرة داخل بنية مرشاح رقمي. تصميم المرشح الرقمي هو ممارسة في تحديد معاملات التصفية التي من شأنها أن تسفر عن استجابة التردد المرشح المطلوب. وبالنسبة لمرشاح معلومات الطيران، تكون معاملات الفلتر، بحكم تعريفها، استجابة النبضة للمرشاح. أمر التصفية - وهو رقم يصف أعلى الأس في البسط أو القاسم لوظيفة نقل النطاق Z للمرشاح الرقمي. وبالنسبة لمرشحات فير، لا يوجد مقام في وظيفة النقل وترتيب الفلتر هو مجرد عدد الصنابير المستخدمة في بنية المرشح. بالنسبة لمرشحات إير، يساوي ترتيب الفلتر عدد عناصر التأخير في بنية الفلتر. وعموما، كلما كان ترتيب المرشح أكبر، كان أداء استجابة حجم التردد للمرشاح أفضل. مرشح الاستجابة النبضية المحدودة (فير) - يحدد فئة من المرشحات الرقمية التي تحتوي على أصفار فقط على مستوى z. وتتمثل الآثار الرئيسية لذلك في أن مرشحات معلومات الطيران ثابتة دائما، ولها استجابات طورية (طالما أن معاملات المرشحات متناظرة). وبالنسبة لترشيح مرشح معين، يكون لمرشحات فير منطقة انتقال تدريجي أكثر بكثير من مرشحات إير الرقمية. استجابة حجم التردد - وصف نطاق التردد لكيفية تفاعل الفلتر مع إشارات الإدخال. وتمثل استجابة حجم التردد في الشكل F-3 منحنى لتوهين المرشاح (دب) مقابل التردد. يرتبط استجابة الفلاتر حجم استجابة المرحلة. تأخر المجموعة - يعرف بأنه مشتق لمرحلة مرشحات فيما يتعلق بالتردد، G - D أوسلاش D f، أو منحدر مرشحات منحنى استجابة هوسلاش (m). ويستحق مفهوم التأخير الجماعي تفسيرا إضافيا يتجاوز تعريف بسيط. بالنسبة للمرشح المثالي، ستكون المرحلة خطية، وسوف يكون تأخير المجموعة ثابتا. ويمكن أيضا اعتبار تأخير المجموعة، الذي تكون وحدة القياس فيه بالثواني، بمثابة التأخر الزمني للانتشار في مغلف إشارة تشكيل اتساعية عند مرورها عبر مرشح رقمي. (ويسمى تأخير المجموعة في هذا السياق عادة بتأخير المغلف). ويحدث تشوه تأخر المجموعة عندما تستغرق الإشارات عند ترددات مختلفة فترات زمنية مختلفة للمرور عبر مرشح. إذا كان التأخير الجماعي يرمز إلى G، فإن العلاقة بين تأخر المجموعة وزيادة D أوسلاش من الطور و D زيادة f للتردد هي كوزين ريسيد و غوز-ريسيد-كوزين فورمولاس معالجة الإشارات الرقمية أسئلة وأجوبة فير فيلتر الأسئلة المتداولة أساسيات الفلتر فير خصائص المرشحات فير فيلتر ديسين مرشحات فير إير فيلتر أسئلة وأجوبة إير أساسيات التصفية مولتيرات فاق أساسيات متعددة أساسيات الاستقراء الاستيفاء 3.4.3 ما الذي يمكنني تعميمه من هذا المثال يوحي الجدول بالملاحظات العامة التالية حول محكمات فير: بما أن نسبة الاستكمال الداخلي هي أربعة (L4 )، هناك أربعة كوتوب-فيلترسكوت (التي تم وضع علامة على مجموعات معامل هنا مع مطابقة الألوان.) وتسمى هذه المرشحات الفرعية رسميا كاتبوليفاس فيلترسكوت. لكل مدخلات، نقوم بحساب المخرجات L عن طريق القيام حسابات L الأساسية فير، كل باستخدام مجموعة مختلفة من المعاملات. عدد الصنابير لكل مرشح متعدد الأطوار هو 3 أو يعبر عنه كصيغة: نبولينتوتال L. ويمكن تحديد معاملات كل مرشح متعدد الأطوار عن طريق تخطي كل معامل لث، بدءا من المعاملات من 0 إلى L-1، لحساب المخرجات المقابلة من 0 إلى L-1. بدلا من ذلك، إذا قمت بإعادة ترتيب معاملاتك مسبقا في ترتيب كوتسكرامبلدكوت مثل هذا: h0، h4، h8، h1، h5، h9، h2، h6، h10، h3، h7، h11 ثم يمكنك فقط خطوة من خلال لهم في النظام. لقد ألمحنا هنا في حقيقة أن N يجب أن تكون متعددة من L. هذا ليس ضروري للغاية، ولكن إذا N ليس متعددة من L، المضاعفات المضافة من استخدام غير متعددة من L في كثير من الأحيان لا يستحق ذلك. حتى إذا كان الحد الأدنى لعدد الصنابير التي تتطلب مواصفات الفلتر الخاص بك لا يحدث أن تكون متعددة من L، أفضل رهان الخاص بك هو عادة لزيادة فقط N إلى مضاعف التالي من L. يمكنك القيام بذلك إما عن طريق إضافة بعض المعاملات صفر قيمة على نهاية المرشح، أو بإعادة تصميم المرشح باستخدام قيمة N الأكبر. 3.4.4 ما هي الوفورات الحسابية التي يمكنني كسبها باستخدام مستكمل معلومات الطيران لأن كل ناتج يتم حسابه باستخدام معاملات نل فقط (بدلا من معاملات N)، فستحصل على كوتسافينغسكوت حسابية (N - نل) لكل ناتج. وهناك طريقة بسيطة للتفكير في مقدار الحساب اللازم لتنفيذ المستكمل الداخلي لمعلومات الطيران وهي أنها تساوي الحساب المطلوب لمرشاح N-تاب غير مستجيب يعمل بمعدل الإدخال. في الواقع، لديك لحساب L مرشحات باستخدام الصنابير نل لكل منهما، لذلك أن مجموع الصنابير N المحسوبة لكل مدخلات. 3.4.5 مقدار مدخرات الذاكرة التي أكتسبها باستعمال جهاز استكمال داخلي (فير) مقارنة بالتطبيق المستقيمي للاستكمال الداخلي عن طريق إزاحة الإشارة عن طريق حشوها بأصفار L-1. ثم تصفية ذلك، يمكنك حفظ الذاكرة بعامل (L-1) L. وبعبارة أخرى، لم يكن لديك لتخزين L-1 صفر محشوة كوبسيمبلسكوت لكل عينة المدخلات الفعلية. 3.4.6 کیف أقوم بتصمیم مستکمل خاص بتقنیة المعلومات (فير) استخدم طریقة تصمیم معلومات الطیران المفضلة. ومعايير التصميم هي: 3.5 التنفيذ 3.5.1 كيف أقوم باستكمال جهاز الاستكمال الداخلي لمعلومات الطيران إن منطقة الاستطلاع الداخلي الاستكشافية هي في الواقع نفس منطقة معلومات الطيران العادية، باستثناء أن لكل نواتج تقوم بحساب النواتج L لكل إدخال باستخدام مرشحات تعدد الأطوار L، لكل منها نل الصنابير. وبشكل أكثر تحديدا: تخزين عينة في خط التأخير. (حجم خط التأخير هو نل.) بالنسبة لكل مجموعة من معامل معامل تعدد الأطوار L، يحسب الإخراج كمجموع المنتجات لقيم خط التأخير ومعاملات الفلتر. قم بتغيير خط التأخير بمقدار واحد لإفساح المجال للإدخال التالي. أيضا، تماما كما هو الحال مع معلومات الطيران العادية، يمكن استخدام المخازن المؤقتة للتخلص من شرط تحويل البيانات حرفيا في خط التأخير. 3.5.2 حيث يمكنني الحصول على شفرة المصدر لتنفيذ إنتيربولاتور فير في C إويجيانز سكوبيفير يأتي مع مجموعة مجانية من خوارزميات متعددة الخوارزميات، بما في ذلك وظائف الاستيفاء فير في C. مجرد تحميل وتثبيت ملف توزيع سكوبيفير. 3.5.3 أين يمكنني الحصول على رمز التجميع لتنفيذ جهاز الاستكمال الداخلي لمعلومات الطيران يقدم بائعو دسب الرئيسيون أمثلة على أجهزة الاستكمال الداخلي لمعلومات الطيران في دفاتر البيانات وملاحظات التطبيقات، لذا تحقق من مواقع الويب الخاصة بهم. 3.5.4 كيف يمكنني اختبار مستشعر معلومات الطيران (فير) يمكن اختبار منطقة معلومات الطيران الاستكشافية بمعظم الطرق التي يمكن أن تختبر بها معلومات الطيران العادية: حالة خاصة من جهاز الاستكمال الداخلي هي منطقة معلومات طيران عادية. وعند إعطاء قيمة قدرها 1 بالنسبة إلى L، ينبغي أن يتصرف المستجيب الداخلي تماما مثل منطقة معلومات الطيران العادية. يمكنك بعد ذلك القيام بدافع، خطوة، واختبارات جيب على ذلك تماما كما يمكنك على منطقة معلومات الطيران العادية. إذا وضعت في جيب الذي تردد داخل نطاق التمرير إنتيربولاتورس، يجب أن يكون الإخراج خالية من التشويه (بمجرد وصول المرشح إلى حالة مستقرة)، وينبغي أن يكون تردد الإخراج هو نفس تردد الإدخال، من حيث المطلق هرتز. يمكنك استخدام اختبار استجابة الخطوة. وبالنظر إلى المدخلات خطوة قيمة القيم، يجب أن تكون كل مجموعة من مخرجات L هي نفس المبالغ من معاملات مرشحات متعدد الأطوار الفردية L، حالما يصل المرشح إلى حالة مستقرة. إعادة التشكيل 4.1 الأساسيات 1.4.1 ما هو المقصود بعبارة "تجميع العينات" يعني الجمع بين الاستكمال الداخلي والإبطال لتغيير معدل أخذ العينات بعامل منطقي. 4-1-2 لماذا تتم إعادة تشكيل العينات عادة ما تتم إعادة الخلط من أجل التفاعل بين نظامين لهما معدلات معاينة مختلفة. إذا كانت نسبة معدالت النظامين هي عدد صحيح أو إفساد أو استيفاء يمكن أن تستخدم لتغيير معدل أخذ العينات) اعتمادا على ما إذا كان المعدل ينخفض ​​أو يزداد (وإال، يجب استخدام االستيفاء والتدمير معا لتغيير المعدل) أ مثال عملي وذو شهرة ناجم عن أن المعدات السمعية المهنية تستخدم معدل أخذ عينات قدره خز 48، غير أن المعدات السمعية للمستهلكين تستخدم معدل 44،1 خز. لذلك، من أجل نقل الموسيقى من تسجيل مهني إلى قرص مضغوط، يجب تغيير معدل أخذ العينات بعامل: (44100 48000) (441 480) (147 160) لا توجد عوامل مشتركة في 147 و 160، لذلك يجب أن نتوقف العوملة عند هذه النقطة. ولذلك، في هذا المثال، سوف نستكمل بمعامل قدره 147 ثم تدمر بعامل قدره 160. 4.1.3 ما هو عامل تقسيم العينة إن عامل الاستكمال الداخلي هو ببساطة نسبة معدل الخرج إلى معدل الدخل. وبالنظر إلى أن عامل الاستكمال الداخلي L هو عامل M، فإن عامل إعادة المعايرة هو L M. وفي المثال أعلاه، يكون عامل إعادة المعاينة 147 160 0.91875 4.1.4 هل هناك قيود على عامل إعادة المعاينة الذي يمكنني استخدامه نعم. وكما هو الحال دائما، يجب استيفاء معايير نيكويست بالنسبة إلى معدل أخذ العينات الناتج، أو نتيجة الاستعارة. وبعبارة أخرى، لا يمكن أن يكون معدل الإخراج أقل من ضعف أعلى تردد (الفائدة) لإشارة الدخل. 4.1.5 عند إعادة الخلط، هل أحتاج دائما إلى مرشح نعم. بما أن إعادة الخلط يتضمن الاستيفاء، فأنت بحاجة إلى فلتر الاستيفاء. وإلا، فإن الصور التي تم إنشاؤها بواسطة جزء محشو صفر من الاستيفاء ستبقى، وإشارة محرف لن يكون سوثكوت كما الأصلي. وبالمثل، بما أن إعادة الخلط يشمل الإفساد، فإنك تحتاج على ما يبدو إلى مرشح التصفية. أو هل أنت منذ مرشح الاستيفاء هو في خط مع مرشح التصفية، هل يمكن فقط الجمع بين المرشحين اثنين من خلال تحويل معاملاتها في مرشح واحد لاستخدامها للتدمير. والأفضل من ذلك، لأن كلاهما مرشحات لوباس، مجرد استخدام أيهما مرشح لديه أدنى تردد قطع كما مرشح الاستيفاء. 4.1.6 كيف أقوم بتصفيح مرشاح إعادة العزلة كما هو ملحوظ في ما يلي: تحديد تردد قطع مرشح التصفية (كما هو مبين في الجزء 2: الانحراف). تحديد تردد قطع مرشاح الاستكمال الداخلي (كما هو موضح في الجزء 3: الاستكمال الداخلي) استخدام أقل من الترددات قطع اثنين لتصميم مرشح إعادة تجميع. 4.2 تعدد المراحل 4.2.1 هل يمكنني إعادة تشكيل في مراحل متعددة نعم، ولكن هناك بضعة قيود: إذا كانت عوامل الاستيفاء أو الإفساد هي أرقام أولية، فلن تتمكن من تحليل تلك الأجزاء من إعادة التركيب إلى مراحل. يجب عليك الحفاظ على معايير نيكويست في كل مرحلة وإلا سوف يؤدي التعرج. وهذا هو، أي مرحلة يمكن أن يكون معدل الانتاج الذي هو أقل من ضعف أعلى تردد من الفائدة. 4.2.2 بارد. ولكن لماذا يزعج مع كل ذلك تماما كما هو الحال مع الاستيفاء والانهيار، يمكن أن متطلبات الذاكرة أندور الحاسوبية للتصفية إعادة اختزال يمكن أن تقلص إلى حد كبير باستخدام مراحل متعددة. 4.3 التنفيذ 4.3.1 كيف أقوم بتنفيذ عملية إعادة الخلط إن التنفيذ المباشر للأخذ بالمعاينة هو إجراء الاستكمال الداخلي بعامل L، ثم إزالته بعامل M. (يجب أن تفعل ذلك بالترتيب بخلاف ذلك، من اإلشارة املطلوبة - اليت ال ميكن للمرتجع استعادتها. (4.3.2 هل هذا التنفيذ املباشر فعال ال. املشكلة هي أنه بالنسبة لعوامل إعادة املعاينة القريبة من 1.0، ميكن أن يكون عامل االستكمال الداخلي كبيرا جدا. على سبيل المثال، في الحالة الموصوفة أعلاه من التغيير من معدل أخذ العينات من 48 كيلو هرتز إلى 44،1 كيلو هرتز، فإن النسبة هي فقط 0.91875، ومع ذلك عامل الاستكمال الداخلي هو 147 أيضا، يمكنك تصفية إشارة مرتين: مرة واحدة في إنتيربولاتور ومرة ​​واحدة في decimator. ومع ذلك، فإن أحد المرشحات يحتوي على نطاق ترددي أكبر من الآخر، وبالتالي فإن فلتر النطاق الترددي الأكبر هو زائدة عن الحاجة. 4.3.3 لذلك ما هو العلاج فقط يجمع بين المزايا الحسابية والذاكرة التي يمكن أن توفرها إنتيربولاتور فير والتطبيقات ديسيماتور. (إذا كنت لا تفهم بالفعل تلك، تأكد من قراءة وفهم الجزء 2: التدمير، والجزء 3: الاستيفاء قبل المتابعة). أولا، يتيح استعراض لفترة وجيزة ما يجعل الاستيفاء فير والإنسان كفاءة: عند الاستيفاء من قبل عامل L، كنت فقط لحساب فعلا 1L من الصنابير منطقة الإنذار في الإخراج إنتيربولاتور. عند إزالته بعامل M، عليك فقط حساب ناتج واحد لكل مدخلات مذبذبة M. لذلك، والجمع بين هذه الأفكار، وسوف نقوم بحساب فقط المخرجات التي نحتاجها في الواقع، وذلك باستخدام مجموعة فرعية فقط من معاملات الاستيفاء لحساب كل ناتج. وهذا يجعل من الممكن لتنفيذ بكفاءة حتى ريسامبلرز فير التي لديها عوامل الاستقراء أندور كبير إخماد. الجزء الصعب هو معرفة أي مرشحات متعدد الأطوار لتطبيق المدخلات، لحساب المخرجات المرجوة، كدالة من L و M. وهناك طرق مختلفة للقيام بذلك، ولكن كل ذلك خارج نطاقنا هنا. 4.3.4 أين يمكنني الحصول على شفرة المصدر لتنفيذ ديسيماتور فير في C إويجيانز سكوبيفير يأتي مع مجموعة مجانية من خوارزميات متعددة الخوارزميات، بما في ذلك وظائف إعادة تقسيم فير في C. مجرد تحميل وتثبيت ملف توزيع سكوبيفير. 4.3.5 كيف يمكنني اختبار ريسامبلر فير الأسلوب الأكثر وضوحا هو وضع في جيب الذي تردد داخل نطاق التمرير ريسامبلرز. إذا خرج جيب غير مشوه، وهذا علامة جيدة. ملاحظة، ومع ذلك، أن هناك عادة ما يكون كوتارمب أوكوت في بداية الجيب، ويرجع ذلك إلى مرشحات تأخير خط ملء مع العينات. لذلك، إذا قمت بتحليل المحتوى الطيفي من جيب، تأكد من تخطي الماضي جزء المنحدر المتابعة. واعتمادا على عامل إعادة الخلط، يمكن اعتبار إعادة الخلط كحالة عامة لأنواع أخرى من الترشيح متعدد الطبقات. يمكن أن يكون: الاستكمال الداخلي: عامل الاستكمال الداخلي، L أكبر من واحد، وعامل الإفساد، M هو واحد. ديسيماتيون: عامل الاستكمال الداخلي، L، واحد، ولكن عامل الإفساد، M، أكبر من واحد. كوتوريندينيكوت تصفية: عوامل الاستيفاء والانهيار، L و M، على حد سواء واحد. لذلك، إذا كنت اختبار بنجاح مع كل هذه الحالات باستخدام الطرق المناسبة لكل حالة، فمن المحتمل أن يكون صحيحا. تحويل فورييه السريع (ففت) التعليمات تحويل فورييه السريع هو واحد من أهم المواضيع في معالجة الإشارات الرقمية ولكن هو موضوع مربك الذي يثير الأسئلة في كثير من الأحيان. هنا، نجيب على الأسئلة الشائعة حول ففت. 1. أساسيات الاتحاد الفرنسي للتنس 1.1 ما هو الاتحاد الفرنسي للتنس تحويل فورييه السريع (ففت) هو ببساطة طريقة سريعة (حسابيا كفاءة) لحساب تحويل فورييه منفصلة (دفت). 1.2 كيف عمل الاتحاد الفرنسي للتنس من خلال الاستفادة من الدوريات في الجيب التي تضاعف للقيام بالتحويلات، ففت يقلل كثيرا من مقدار الحساب المطلوب. هيريس نظرة عامة قليلا. وظيفيا، وفت تتحلل مجموعة من البيانات التي سيتم تحويلها إلى سلسلة من مجموعات البيانات الصغيرة التي سيتم تحويلها. ثم، فإنه تتحلل تلك مجموعات أصغر في مجموعات أصغر. في كل مرحلة من مراحل المعالجة، يتم الجمع بين نتائج المرحلة السابقة بطريقة خاصة. وأخيرا، فإنه يحسب دفت من كل مجموعة بيانات صغيرة. على سبيل المثال، يتم تحويل ففت من حجم 32 إلى 2 ففتس من حجم 16، والتي يتم تقسيمها إلى 4 ففتس من حجم 8، والتي يتم تقسيمها إلى 8 ففتس من حجم 4، والتي يتم تقسيمها إلى 16 ففتس من حجم 2. حساب دفت من حجم 2 هو تافهة. هيريس شرح أكثر صرامة قليلا: اتضح أنه من الممكن اتخاذ دفت من أول N2 نقطة والجمع بينهما بطريقة خاصة مع دفت من N2 نقطة الثانية لإنتاج واحد N - نقطة دفت. ويمكن حساب كل من دفت N2 نقطة هذا باستخدام دفت أصغر بنفس الطريقة. واحد (الجذر 2) يبدأ الاتحاد الفرنسي للتنس، وبالتالي، من خلال حساب N2 2 نقطة دفتس. يتم الجمع بين هذه لتشكيل N4 4 نقطة دفتس. تنتج المرحلة التالية دفت N8 8 نقاط، وهلم جرا، حتى يتم إنتاج دفت N نقطة واحدة. 1.3 مدى كفاءة تحويل فورييه السريع (ففت) يأخذ دفت عمليات N2 لنقاط N. وبما أن الحساب المطلوب للجمع بين دفت أصغر في دفت أكبر يتناسب مع N، وهناك مراحل log2 (N) (للجذر 2)، فإن الحساب الإجمالي يتناسب مع N log2 (N). ولذلك، فإن النسبة بين حساب دفت وحساب تحويل فورييه السريع للنفس N تتناسب مع N log2 (n). وفي الحالات التي تكون فيها N صغيرة، فإن هذه النسبة ليست كبيرة جدا، ولكن عندما تصبح N كبيرة، فإن هذه النسبة كبيرة جدا. (في كل مرة مضاعفة N، البسط الزوجي، ولكن القاسم يزيد فقط من قبل 1.) 1.6 هي فتس تقتصر على الأحجام التي هي صلاحيات 2 نو. ففت الأكثر شيوعا ومألوفة هي كوتراديكس 2quot. ومع ذلك، تستخدم أحيانا رادعات أخرى، والتي عادة ما تكون أعدادا صغيرة أقل من 10. على سبيل المثال، الجذر 4 هو جذابة بشكل خاص لأن كوتويدل فاكتورسكوت كلها 1، -1، ي، أو - ج، والتي يمكن تطبيقها دون أي مضاعفات على الاطلاق. أيضا، كوتكسد راديكسكوت فتس أيضا يمكن القيام به على أحجام كوتكومبوسيتكوت. في هذه الحالة، يمكنك كسر حجم غير رئيسي أسفل إلى العوامل الرئيسية، والقيام الاتحاد الفرنسي للتنس مراحله تلك العوامل. على سبيل المثال، يمكن أن يتم تحويل فورييه السريع من حجم 1000 في ست مراحل باستخدام راديتس من 2 و 5، منذ 1000 2 2 2 5 5 5. ويمكن أيضا أن يتم ذلك في ثلاث مراحل باستخدام الجذر 10، منذ 1000 10 10 10. 1.7 يمكن يتم إجراء فتس على أحجام أولية نعم، على الرغم من أن هذه هي أقل كفاءة من أحادية الجذر أو ففت مختلط الجذر. فمن الممكن دائما تقريبا لتجنب استخدام أحجام رئيس الوزراء. 2. ففت المصطلحات 2.1 ما هو ففت كراديكسكوت كراديكسكوت هو حجم التحلل ففت. في المثال أعلاه، كان الجذر 2. بالنسبة إلى ففت أحادي الجذر، يجب أن يكون حجم التحويل قوة للجذر. في المثال أعلاه، كان حجم 32، وهو 2 إلى 5 السلطة. 2-2 ما هي العوامل المفترضةالعوامل التي تستخدم في الجمع بين نتائج المرحلة السابقة وتشكيل المدخلات إلى المرحلة التالية. 2.3 ما هو كوتين بلاسيكوت ففت و كوتين بلاسيكوت ففت هو ببساطة ففت التي يتم حسابها تماما داخل ذاكرة العينة الأصلية. وبعبارة أخرى، فإن حساب فوت كوتينكوت فوت لا يتطلب ذاكرة عازلة إضافية (كما تفعل بعض ففتس.) 2.4 ما هو عكس كوبيت ريتيرالكوت هو عكس ما يبدو: عكس البتات في كلمة ثنائية من اليسار إلى اليمين. لذلك تصبح مسبات تصبح لسسب و لسبس تصبح مسب. ولكن ماذا يتعلق ذلك مع فتس حسنا، ترتيب البيانات المطلوبة من قبل الجذر 2 فتس تبين أن يكون في ترتيب عكس كوبيت، لذلك يتم استخدام فهارس عكس بت الجمع بين مراحل الاتحاد الفرنسي للتنس. ومن الممكن (ولكن بطيء) لحساب هذه المؤشرات عكس البتات في البرمجيات ومع ذلك، عكس البتات تافهة عند تنفيذها في الأجهزة. ولذلك، فإن جميع معالجات دسب تقريبا تشمل قدرة فهرسة عكس بتات الأجهزة (وهي واحدة من الأشياء التي تميزها عن المعالجات الدقيقة الأخرى). 2.5 ما هو كوتديسيماتيون-إن-تيمكوت مقابل كوتديسيماتيون-إن-فريكونسيوتوت يمكن تحليلها باستخدام فتس من دفتس (ففت) ديتيماتيون-إن-تايم (ديت) في الوقت المناسب، أو يمكن تحليلها باستخدام نهج النصف الأول من النصف الثاني، وهو ما يسمى ففت كوتيسيماتيون-إن-فريكونسيكوت (ديف). عموما، المستخدم لا داعي للقلق أي نوع يتم استخدامه. 3. تنفيذ برنامج التدريب مقابل التدريب 1.3 كيف أقوم بتنفيذ برنامج التدريب مقابل التدريب باستثناء عملية التعلم، لن تضطر أبدا إلى ذلك. تتوفر العديد من عمليات ففت جيدة في C و فورتران ولغات أخرى، وتقدم الشركات المصنعة للمعالجات الدقيقة عموما عمليات ففت المحسنة المجانية في كود تجميع المعالجات الخاصة بهم، ولذلك، ليس من المهم أن نفهم كيف يعمل الاتحاد الفرنسي للتنس حقا، كما هو لفهم كيف لتستخدمها. 3.2 إم غير مقتنع. أريد أن أتعلم حقا كيف يعمل الاتحاد الفرنسي للتنس. (يا إلهي كنت صعبة) حسنا، تقريبا كل كتاب دسب على كوكب الأرض يغطي الاتحاد الفرنسي للتنس بالتفصيل. ومع ذلك، إذا كنت ترغب في قراءة شيء على الانترنت الآن، انظر دليل العلماء والمهندسين ل دسب. 3.3 حسنا، قرأت تلك الأشياء. يتيح قطع لمطاردة. أين يمكنني الحصول على تنفيذ ففت إذا كنت ترغب في تنفيذ لغة التجميع، تحقق من موقع الشركة المصنعة للمعالج الدقيق دسب الذي اخترته. فهي توفر عموما تطبيقات التجميع الأمثل للغاية في أدلة المستخدمين وأدلة التطبيق، وأيضا كجزء من مكتبة من المجمعين C بهم. وهنا بعض من أفضل C إمبلميناتيونس: ميكسففت - هذا ففت مختلطة الجذر إمبلميناتيون من قبل جينز يورغن نيلسن سريع ومرن، وسهلة الاستخدام. فتو - تحويل فورييه كوفاستيست في ويستكوت. هناك العديد من هوتليستس كبيرة ففت على الشبكة. واحدة من أفضل هو جيس مفيدة وقبيحة الاتحاد الفرنسي للتنس الصفحة. و فتو أيضا صفحة وصلات ففت جيدة جدا. المساهمون ساهم الأشخاص التالية أسئلتهم أو إجاباتهم أو اقتراحاتهم المفيدة: ديل غروفر. ماريوس فولمر كورديك أسئلة وأجوبة كورديك هو خوارزمية تكرارية لحساب وظائف تريغ بما في ذلك جيب وجيب التمام، وحجم ومرحلة. وهي مناسبة بشكل خاص لتطبيقات الأجهزة لأنها لا تتطلب أي مضاعفات. 1.1 ماذا يعني كوتورديكوت التنسيق R أوتاتيون دي جيتال C أومبوتر. (لا يساعد كثيرا، هل يفعل ذلك) 1.2 ماذا يفعل فإنه يحسب الدوال المثلثية من جيب، جيب التمام، وحجم ومرحلة (أركتانجنت) إلى أي الدقة المطلوبة. ويمكن أيضا حساب وظائف القطعي، ولكن نحن لا تغطي ذلك هنا. 1.3 كيف يعمل كورديك حول فكرة كوتاتاتينغكوت المرحلة من عدد معقد، عن طريق ضربه من قبل سلسلة من القيم الثابتة. ومع ذلك، يمكن أن يكون كل مضاعفات القوى 2، وذلك في الحساب الثنائي يمكن القيام به باستخدام التحولات فقط ويضيف لا حاجة إلى مضاعف الفعلي. 1.4 كيف تقارن مع النهج الأخرى بالمقارنة مع النهج الأخرى، كورديك هو الفائز واضح عندما يكون مضاعف الأجهزة غير متوفر، على سبيل المثال. في متحكم، أو عندما تريد حفظ البوابات المطلوبة لتنفيذ واحد، على سبيل المثال. في فبغا. من ناحية أخرى، عندما يتوفر مضاعف الأجهزة، على سبيل المثال. في معالج دسب، وطرق البحث الجدول وسلسلة السلطة الجيدة الطراز القديم عموما أسرع من كورديك. 2.0 أمثلة 2.1 هل لديك مثال في شكل جدول بيانات إكسيل مضحك يجب أن تسأل: أنا فقط يحدث ل: cordic-xls. zip. أنا أوصي لك فتح هذا وتبدو أكثر قليلا قبل أن تسأل أي أسئلة أخرى. 2.2 هل لديك مثال كما كود C 3.0 مبادئ لتدوير على مراحل أقل من 90 درجة، ونحن سوف تضرب بأرقام من النموذج كوار 1 - جكوت. K سوف تنخفض صلاحيات اثنين، بدءا من 20 1.0. لذلك، K 1.0، 0.5، 0.25، الخ (نحن نستخدم أنها رمز كوتلكوت لتعيين قوة اثنين نفسها: 0، -1، -2، الخ) منذ مرحلة من عدد معقد كوتي جكوت هو أتان (كي) ، فإن المرحلة من 1 جكوت هو أتان (K). وبالمثل، فإن المرحلة من كوت 1 - جكوت أتان (-K) - anan (K). لإضافة مراحل نستخدم كير 1 جكوت لطرح مراحل نستخدم كير 1 - جكوت. وبما أن الجزء الحقيقي من هذا، إر، يساوي 1، يمكننا تبسيط جدولنا من المعادلات لطرح وطرح مراحل لحالة خاصة من مضاعفات كورديك إلى: لإضافة مرحلة، تتضاعف بواسطة R 1 جك: إيك إيك - كميدوتك Ic - (2-L)middotQc Ic - (Qc gtgt L) Qc Qc KmiddotIc Qc (2-L)middotIc Qc (Ic gtgt L) To subtract a phase, multiply by R 1 - jK: Ic Ic KmiddotQc Ic (2- L)middotQc Ic (Qc gtgt L) Qc Qc - KmiddotIc Qc - (2-L)middotIc Qc - (Ic gtgt L) Lets look at the phases and magnitudes of each of these multiplier values to get more of a feel for it. The table below lists values of L, starting with 0, and shows the corresponding values of K, phase, magnitude, and CORDIC Gain (described below):A few observations: Since were using powers of two for the K values, we can just shift and add our binary numbers. Thats why the CORDIC algorithm doesnt need any multiplies You can see that starting with a phase of 45 degrees, the phase of each successive R multiplier is a little over half of the phase of the previous R. Thats the key to understanding CORDIC: we will be doing a quotbinary searchquot on phase by adding or subtracting successively smaller phases to reach some target phase. The sum of the phases in the table up to L 3 exceeds 92 degrees, so we can rotate a complex number by - 90 degrees as long as we do four or more quotR 1 - jKquot rotations. Put that together with the ability to rotate -90 degrees using quotR 0 - j1quot, and you can rotate a full -180 degrees. Each rotation has a magnitude greater than 1.0. That isnt desirable, but its the price we pay for using rotations of the form 1 jK. The quotCORDIC Gainquot column in the table is simply a cumulative magnitude calculated by multiplying the current magnitude by the previous magnitude. Notice that it converges to about 1.647 however, the actual CORDIC Gain depends on how many iterations we do. (It doesnt depend on whether we add or subtract phases, because the magnitudes multiply either way.) 4.0 Applications 4.1 How can I use CORDIC to calculate magnitude You can calculate the magnitude of a complex number C Ic jQc if you can rotate it to have a phase of zero then its new Qc value would be zero, so the magnitude would be given entirely by the new Ic value. quotSo how do I rotate it to zero, quot you ask Well, I thought you might ask: You can determine whether or not the complex number quotCquot has a positive phase just by looking at the sign of the Qc value: positive Qc means positive phase. As the very first step, if the phase is positive, rotate it by -90 degrees if its negative, rotate it by 90 degrees. To rotate by 90 degrees, just negate Qc, then swap Ic and Qc to rotate by -90 degrees, just negate Ic, then swap. The phase of C is now less than - 90 degrees, so the quot1 - jKquot rotations to follow can rotate it to zero. Next, do a series of iterations with successively smaller values of K, starting with K1 (45 degrees). For each iteration, simply look at the sign of Qc to decide whether to add or subtract phase if Qc is negative, add a phase (by multiplying by quot1 jKquot) if Qc is positive, subtract a phase (by multiplying by quot1 - jKquot). The accuracy of the result converges with each iteration: the more iterations you do, the more accurate it becomes. Editorial Aside: Since each phase is a little more than half the previous phase, this algorithm is slightly underdamped. It could be made slightly more accurate, on average, for a given number of iterations, by using quotidealquot K values which would addsubtract phases of 45.0, 22.5, 11.25 degrees, etc. However, then the K values wouldnt be of the form 2-L, theyd be 1.0, 0.414, 0.199, etc. and you couldnt multiply using just shiftadds (which would eliminate the major benefit of the algorithm). In practice, the difference in accuracy between the ideal Ks and these binary Ks is generally negligible therefore, for a multiplier-less CORDIC, go ahead and use the binary Ks, and if you need more accuracy, just do more iterations. Now, having rotated our complex number to have a phase of zero, we end up with quotC Ic j0quot. The magnitude of this complex value is just Ic, since Qc is zero. However, in the rotation process, C has been multiplied by a CORDIC Gain (cumulative magnitude) of about 1.647. Therefore, to get the true value of magnitude we must multiply by the reciprocal of 1.647, which is 0.607. (Remember, the exact CORDIC Gain is a function of the how many iterations you do.) Unfortunately, we cant do this gain-adjustment multiply using a simple shiftadd however, in many applications this factor can be compensated for in some other part of the system. Or, when relative magnitude is all that counts (e. g. AM demodulation), it can simply be neglected. 4.2 How can I use CORDIC to calculate phase To calculate phase, just rotate the complex number to have zero phase, as you did to calculate magnitude. Just a couple of details are different. For each phase-additionsubtraction step, accumulate the actual number of degrees (or radians) you have rotated. The actuals will come from a table of quotatan(K)quot values like the quotPhase of Rquot column in the table above. The phase of the complex input value is the negative of the accumulated rotation required to bring it to a phase of zero. Of course, you can skip compensating for the CORDIC Gain if you are interested only in phase. 4.3 Since magnitude and phase are both calculated by rotating to a phase of zero, can I calculate both simultaneously Yes--youre very astute. 4.4 How can I use CORDIC to calculate sine and cosine You basically do the inverse of calculating magnitudephase by addingsubtracting phases so as to quotaccumulatequot a rotation equal to the given phase. Specifically: Start with a unity-magnitude value of C Ic jQc. The exact value depends on the given phase. For angles greater than 90, start with C 0 j1 (that is, 90 degrees) for angles less than -90, start with C 0 - j1 (that is, -90 degrees) for other angles, start with C 1 j0 (that is, zero degrees). Initialize an quotaccumulated rotationquot variable to 90, -90, or 0 accordingly. (Of course, you also could do all this in terms of radians.) Do a series of iterations. If the desired phase minus the accumulated rotation is less than zero, add the next angle in the table otherwise, subtract the next angle. Do this using each value in the table. The quotcosinequot output is in quotIcquot the quotsinequot output is in quotQcquot. A couple of notes: Again, the accuracy improves by about a factor of two with each iteration use as many iterations as your applications accuracy requires. This algorithm gives you both cosine (Ic) and sine (Qc). Since CORDIC uses complex values to do its magic, its not possible to calculate sine and cosine separately. 5.0 References 5.1 Where can I learn more about CORDIC on-line 5.2 What are some article references for CORDIC Jack E. Volder, The CORDIC Trigonometric Computing Technique . IRE Transactions on Electronic Computers, September 1959. J. E. Meggitt, Pseudo Division and Pseudo Multiplication Processes . IBM Journal, April 1962. 5.3 What are some book references for CORDIC M. E. Frerking. Digital Signal Processing in Communication Systems Fre94 . Henry Briggs, Arithmetica Logarithmica . 1624. 6.0 Acknowledgments Thanks to Ray Andraka for helping me understand. Thanks to Rick Lyons for review. Thanks to Mark Brown and Bill Wiese for providing links. Raised Cosine FAQ Raised-Cosine filters are commonly used in digital data modems. Here, we answer some RC filter Frequently Asked Questions (FAQs). 1. Raised Cosine Filter Basics 1.1 What are Raised-Cosine (RC) Filters 2.0 Design 2.1 How do I implement RC and RRC filters RC and RRC filters are generally implemented as FIR (Finite Impulse Response) filters. The linear-phase property of FIR filters makes them. Also, FIR filters are easy-to-implement and efficient. See our FIR Filter FAQ for more FIR information. 2.2 What are the parameters for RC and RRC filters The frequency responses of RC and RRC filters are fully specified by a single paramter, the quotrolloff factorquot this is a number between 0.0 and 1.0. It often is symbolized as either alpha or beta . But to design a FIR filter that will actually implement an RC or RRC response, you also need two more parameters, the number of taps (quotNTapsquot), and the number of samples per symbol (quot 2.3 How do I design RC and RRC filters RC and RRC filters can be designed in either the time domain (FIR impulse reponse) or the frequency domain (FIR frequency response). To design in the time domain, calculate the FIR filter coefficients directly from a formula (see below). To design in the frequency domain, use the definition of the RC or RRC response to fill an array representing the RCRRC frequency response. Then, use the Inverse Discrete Fourier Transform (IDFT) to calculate the FIR filters impulse response (coefficients). 2.4 What are some formulas for a Raised-Cosine and Root-Raised-CosineFilters 2.4 What FIR filter design programs can design RC and RRC filters This FAQ is still Under Construction. Digital Signal Processing HowTos How to Interpolate in the Time-Domain by Zero-Padding in t he Frequency Domain How to Interpolate in the Time-Domain by Zero-Padding in the Frequency Domain Performing interpolation on a sequence of time-domain samples is an important (often used) process in DSP, and there are many descriptions of time-domain interpolation (a kind of curve fitting) in the literature and on the Internet. However, therersquos a lesser-known scheme used for interpolation that employs the inverse discrete Fourier transform (IDFT). This little tutorial attempts to describe that technique. One of the fundamental principles of discrete signals is that quotzero paddingquot in one domain results in an increased sampling rate in the other domain. For example, the most common form of zero padding is to append a string of zero-valued samples to the end of some time-domain sequence. Looking at a simple example of this notion, Figure 1(a) shows a Hanning window sequence w(n) defined by 32 time samples. If we take a 32-point DFT of w(n), and just look at the magnitudes, we get the W dB (m) spectral magnitude plot shown in Figure 1(b). If, on the other hand, we zero pad (append) 96 zero-valued samples to the end of w(n), wersquoll have the 128-sample wrsquo(n) sequence shown in Figure 1(c). The spectral magnitude plot of a 128-point DFT of wrsquo(n) is shown in Figure 1(d), where we can see the more detailed structure of the Fourier transform of a Hanning window. So, in this case, we can say quotzero padding in the time domain results in an increased sampling rate in the frequency domainquot. Here the zero padding increased our frequency-domain sampling (resolution) by a factor of four (12832). For each sample in Figure 1(b), we have four samples in Figure 1(d). Many folk call this process quotspectral interpolationquot. OK, thatrsquos time-domain zero padding. No big deal, yoursquove probably seen this before. Now letrsquos see what frequency-domain zero padding (FDZP) will do for us by way of an example. Think of an 8-sample real discrete sequence comprising the sum of a 1 kHz and a 2 kHz sinusoids defined as: x(n)sin(2middotpimiddot1000middotnt s ) 0.5sin(2middotpimiddot2000middotnt s 3middotpi4), where t s is the sample period (1f s ), and the f s sample rate is 8000 samplessecond. Our eight x(n) samples are shown as the black dots in Figure 2. Wersquoll call x(n)rsquos 8-point DFT the frequency-domain sequence X(m), the real and imaginary parts of which are shown in Figure 3(a) and 3(b). OK, herersquos where the zero padding comes in. If we insert 8 zero-valued complex samples in the middle of X(m), wersquoll have a new complex spectrum whose real and imaginary parts are shown in Figure 3(c) and 3(d). Realize, now, that a complex zero is merely 0 j0. That quotmiddle of X(m)quot phrase means just prior to half the sample rate, or 4 kHz in this example. Because of the way the X(m)rsquos sample index numbering is mapped to the frequency-domain axis, we can think of this f s 2 4 kHz point as the highest positive frequency in the spectrum. Thus we insert the zeros after the first N2 spectral samples, where N is the length of X(m), in order to maintain spectral symmetry. (Wersquore assuming that the 4 kHz, X(N2), spectral component is zero, or at least negligibly small, in magnitude.) OK, letrsquos call this new 16-sample discrete spectrum Xrsquo(m). Now, herersquos the slick part. If we take a 16-point inverse DFT of Xrsquo(m), wersquoll get the interpolated time sequence shown in Figure 4. Check it out In between each of the original x(n) samples (shaded dots), wersquove calculated the intermediate time samples (the black dots). All 16 dots in Figure 4 represent the new interpolated 16-sample xrsquo(n) sequence. In this case, we can say quotzero padding in the frequency domain results in an increased sampling rate in the time domainquot. A few things to keep in mind about this FDZP technique: 1.) Notice the agreeable property that the FDZPrsquos interpolated time samples match the original time samples. (The shaded dots in Figure 4.) 2.) We must not append zeros to the end of the X(m) sequence, as occurs in time-domain zero padding. The complex zero padding must take place exactly in the middle of the original X(m) sequence, with the middle frequency sample being f s 2. 3.) The new time sequence xrsquo(n), the inverse DFT of Xrsquo(m), is complex. However, if we stuffed the zeros properly Xrsquo(m) will symmetrical and xrsquo(n)rsquos imaginary parts should all be zero (other than very small computational errors). Thus Figure 4 is a plot of the real parts of xrsquo(n). 4.) Notice how the amplitudes of the new xrsquo(n) time sequence were reduced by a factor of two in our example. (This amplitude reduction can, of course, be avoided by doubling either the Xrsquo(m) or the xrsquo(n) amplitudes.) 5.) In Figure 4 we interpolated by a factor of two. Had we stuffed, say, 24 zeros into the X(m) sequence, we could perform interpolation by a factor of four using the inverse fast Fourier transform (IFFT). The point here is that the number of stuffed zeros must result in an Xrsquo(m) sequence whose length is an integer power of two if you want to use the efficient radix-2 inverse FFT algorithm. If your new Xrsquo(m) sequencersquos length is not an integer power of two, yoursquoll have to use the inverse discrete Fourier (IDFT) transform to calculate your interpolated time-domain samples. Although I havent gone through a mathematical analysis of this scheme, the fact that its called quotexact interpolationquot in the DSP literature is reasonable for periodic time-domain sequences. Think of the standard technique used to perform time-domain interpolation using a low-pass FIR filter. In that method, zero-valued samples are inserted between each of the original time samples, and then the new (lengthened) sequence is applied to an FIR filter to attenuate the spectral images caused by the inserted zeros. The accuracy of that FIR filter interpolation technique depends on the quality of the filter. The greater the low-pass FIR stopband attenuation, the greater the image rejection, and the more accurate the time-domain interpolation. In this FDZP technique, for periodic time signals, image rejection is ideal in the sense that the spectral images all have zero amplitudes. If our original time-domain sequence is not periodic, then the FDZP scheme exhibits the Gibbs phenomenon in that there will be errors at the beginning and end of the interpolated time samples. When we try to approximate discontinuities in the time-domain, with a finite number of values in the frequency-domain, ripples occur just before and after the approximated (interpolated) discontinuity in the time-domain. Of course, if your original time sequence is very large, perhaps you can discard some of the initial and final erroneous interpolated time samples. From a practical standpoint, its a good idea to model this FDZP technique to see if it meets the requirements of your application. One last thought here. For those readers with Law Degrees, dont try to cheat and use this FDZP technique to compensate for failing to meet the Nyquist sampling criterion when your x(n) time samples were originally obtained. This interpolation technique wont help because if you violated Nyquist to get x(n), your X(m) DFT samples will be invalid due to aliasing errors. This FDZP scheme only works if Nyquist was satisfied by the original x(n). About the Author: copy 1999 Richard G. Lyons Used with permission. How to Design Minimum-Phase FIR Filters How to Design Minimum-Phase FIR Filters by Matt Donadio Like most things in DSP, there are several methods to create minimum-phase Finite Impulse Response (FIR) filters. Zero Inversion If you want to transform a symetric (linear phase) FIR into a minimum-phase FIR of the same length, you can simply determine the zeros of h(n), and then invert zeros which are outside the unit-circle (i. e. compute the reciprical). Since the zeroes of real, symetric FIR filters are grouped as conjugate recipricals ( a jb . a - jb . 1 (a jb) . and 1 (a - jb) ), all of the zeros will be doubles. (However, if the FIR has even length, there will also be a zero at w pi .) The filter will be suboptimal with respect to its length, but if you are experienced with pole-zero manipulation, you can move some of the zeros around to get a better filter. Spectral Factorization A second method, described in Lim88. is called Spectral Factorization . This method builds on the first. In the first method, we end up with pair of double zeros and a suboptimal filter. We can then design a prototype filter that meets H(z)2 and then convert it into a filter H(z) that has minimum phase. We can outline this as: Create an equiripple filter, FIR1, that will meet H(z)2 Calculate the zeros of FIR1. Delete the zeros outside the unit circle. Delete half of the double zeros on the unit circle. Convert the zeros into coefficient form. Compensate the gain of the new filter. This approach has a few subtlies, though. First is creating the prototype filter. We have to insure that the magnitude response remains positive. This somewhat complicates an equiripple design, but can be dealt with. If dp and ds are the required passband and stopband ripple for a lowpass minimum phase FIR, then the passband ripple of the prototype filter needs to be 4.0 dp (2.0 2.0 dp dp - ds ds) and the stopband ripple ds ds (2.0 2.0 dp dp - ds ds) This leads us to the second problem. The requirements above can result in a farirly long filter because the prototype filter is designed proportional to the squares of the final ripples. This can make it difficult to accurately calculate the roots of the prototype filter. Homomorphic Filtering A third method for creating a minimum phase filter uses homomorphic filtering . It is described in the both Lim88 and Opp89. We take the coefficients of our prototype filter as a sequence, then extract the minimum-phase component using a frequency-invariant linear filter. The steps are: Create an equiripple filter, that will meet H(z)2. Zero-pad the FIR. Four times the filter length works well. Calculate the DFT (or FFT) of the above. Calculate 0.25 log(H(k)2). Calculate IDFT (with scaling factor) of the results. Multiply pointwise by the homomorphic filter lminn 2un - dn, where dn dirac delta function. Calculate DFT of results. Calculate complex exponential of results. Calculate IDFT (with scaling factor) of the results. Keep half (or half 1 if orig length was odd) of the results as the minimum phase filter. The only real problem with this method is making sure that the DFTs are long enough to minimize the aliasing error. (Thanks to Roland Froehlich for giving me some code to test my implementation against.) Optimal Real and Complex Design Method The above methods only work for creating real-valued minimum phase filters. In addition, the methods that delete zeros in the Z domain need to use polynomial inflation to turn the final zeros into the filter coeficients. Polynomial inflation, in addition to root finding, can suffer from catastrphic numerical errors. A new method has been developed that can create both real and complex-valued FIR filters for arbitrary magnitude responses. This method is non-iterative and relies on properties of the Discrete Hilbert Transform. It can also be extended into higher dimensions. The interested reader should visit the page Optimal Design of Real and Complex Minimum-Phase Digital FIR Filters for more info. References How to Create Oscillators in Software How to Create Oscillators in Software by Matt Donadio Oscillators can be created in software directly, using the quotsinequot function, or they can be calculated indirectly using several different iterative methods. We survey those methods here. First, lets assume that: Real Oscillator Now, creating a real oscillator in software is equivalent to sampling a sinusoid, so is sufficient. This isnt very efficient, though, because we calculate a sine for each output point (though using a sine approximation can speed things up a little.) Another way is to use the following recurrence relationship for sinusoids: In pseudocode, it would look like: This has a problem, though. The recurrence relationship is a 2nd-order all-pole system with: into the standard quadradic equation solver: This has a pair of conjugate poles on the unit circle, and as a result, is nearly unstable. Despite this, the above approach tends to work well in practice, depending on the application, numerical representation, and precision used. (Fre94 has an excellent discussion of this method.) Complex Oscillator For a complex (quadrature) oscillator, we can use the above method using cosine for the real arm and sine for the quadrature arm (you can actually generate both at the same time see the Frerking for details). Another method is to view the problem as a rotating vector. We can create an initial vector and rotate is using a complex multiply for each point. You can derive this method from the cos(A B) and sin(A B) trig relationships. This approach still suffers from stability problems, though. The new recurrence relationship is This system has a single pole on the unit circle and is unstable. In this case, we can deal with it. We know that the length of the vector is 1, so we can normalize each point as we create it. If we define the magnitude of yn as inside of the quotforquot loop to normalize the magnitude of yn. We loose efficiency, though, because we calculate a square root for each point. However, if x is close to 1, then Since the length of the rotating vector will always be close to 1 (it will only stray from 1 due to roundoff error), we can use this relationship. We can change the AGC inside the for loop to Another method for creating an oscillator is to use a lookup table. The key to understanding the lookup table approach is understanding the concept of the phase accumulator. Lets look at a sampled sinusoid we can write the sampled sinusoid as Since the variable quotiquot is monotnically increasing by 1 each iteration, we can rewrite this as Now, here is the key. A very easy way to do modulo addition is to use twos complement math. So, if we make dw a twos complement register, the mod 2pi is implicitly done, and we can also use it to index into a precalculated lookup table. If we have M bits, then the most negative number will represent - pi and the most positive number will represent pi (minus a smidge). In practical applications, if we need N bits of phase resolution in the lookup table, we only use a table with 2 N4 entries and use the symetrical properties of sine to choose the proper entry. We also usually use a phase accumulator, delta phase, and initial phase with M bits, and M gt N. When we index into the lookup table we take N top bits of the phase accululator (either round or truncate) as the index. Reference: How to Generate White Gaussian Noise How to Generate White Gaussian Noise by Matt Donadio White Gaussian Noise (WGN) is needed for DSP system testing or DSP system identification. Here are two methods for generating White Gaussian Noise. Both rely on having a good uniform random number generator. We will assume that the function quotuniform()quot returns a random variable in the range 0, 1 and has good statistical properties. (Be forewarned, though, that many standard random number generators have poor statistical properties.) Once we can generate noise signals with normal distribution, we can adjust the signals mean and variance to use it for any purpose. Central Limit Thorem Method The Central Limit Theorm states that the sum of N randoms will approach normal distribution as N approaches infinity. We can outline an algorithm that uses this approach as: When the algorithm finishes, X will be our unit normal random. X can be further modified to have a particular mean and variance, e. g.: The drawback to this method is that X will be in the range - N, N, instead of (-Infinity, Infinity) and if the calls to uniform are not truly independent, then the noise will no longer be white. Jeruchim, et. الله. recommend N gt20 for good results. Box-Muller Method The Box-Muller method uses the technique of inverse transformation to turn two uniformly distributed randoms, U1 and U2, into two unit normal randoms, X and Y. We can use some trigonometry to simplify this a bit and get: The above is called the Polar Method and is fully described in the Ross book Ros88. X and Y will be unit normal random variables (mean 0 and variance 1), and can be easilly modified for different mean and variance. How to Interpolate the Peak Location of a DFT or FFT if the Frequency of Interest is Between Bins How to interpolate the peak location of a DFT or FFT if the frequency of interest is between bins If the actual frequency of a signal does not fall on the center frequency of a DFT (FFT) bin, several bins near the actual frequency will appear to have a signal component. In that case, we can use the magnitudes of the nearby bins to determine the actual signal frequency. This is a summary of some methods found at Some Frequency Estimation Algorithms. (Other methods of sinusoidal parameter estimation which do not rely on the DFT are found on that page those methods also work well, and are sometimes faster than these.) The following notation is used below: k index of the max (possibly local) magnitude of an DFT. Xi bin quotiquot of an DFT Xi magnitude of DFT at bin quotiquot. k the interpolated bin location. The first two methods appeared in comp. dsp posts. Quadradic Method ( see post ) : Barycentric method (see post ) : Quinns First Estimator: Quinns Second Estimator: tau(x) 14 log(3x2 6x 1) - sqrt(6)24 log((x 1 - sqrt(23)) (x 1 sqrt(23))) ap (Xk 1.r Xk. r Xk1.i Xk. i) (Xk. r Xk. r Xk. i Xk. i) dp - ap (1 - ap) am (Xk - 1.r Xk. r Xk - 1.i Xk. i) (Xk. r Xk. r Xk. i Xk. i) dm am (1 - am) d (dp dm) 2 tau(dp dp) - tau(dm dm) k k d Jains Method : Of the above methods, Quinns second estimator has the least RMS error. References Posted 19990419, Released 19990503, Revised 19990505 Digital Signal Processing Tricks One of the things that makes DSP so interesting is its wide variety of tricks, usually to reduce the processing required for a given operation. The right DSP trick can be a nugget of gold. Here, we provide a gold mine of well known - and not so well known - DSP tricks. Expanded Table of Contents Top-Level Table of Contents Filtering Tricks DSP Trick: Simple Filter Coefficient Interpolation Often it is necessary to design a FIR filter coefficient set that is longer than can be practically computed using common automated routines like Parks-McLellan or its Remez subroutine. In most cases this problem can be alleviated by using P-M or Remez to design a short coefficient set and then interpolating it up to the desired length. A simple interpolation method that avoids some of the distortions that may be associated with linear, spline, or polynomial interpolation utilizes the interpolating capabilities of the DFT. The procedure may be achieved as follows: Design a shortened FIR filter that can be computed using an appropriate design technique. Take a forward DFT of this shortened FIR coefficient set. Zero pad the result up to the desired length of the final filter. Take the inverse-DFT of the zero-padded vector. The real part of the inverse-DFT is the interpolated coefficient set of the desired length. It is always prudent to verify that the interpolated filter has the desired response. Eric Jacobsen Minister of Algorithms, EF Data Corp. DSP Trick: FIR Filtering in C Name: Filtering in C Category: Programming Trick Advantages: Simple and fast This is more like a trick in C but might also be applicable in DSP environments. It allows to compute FIR-filtering in a fast manner when the filter length contains a factor of, lets say 4 (other factors are also possible). Lets suppose you have an array for the FIR filter coefficients wLEN and an array for the delay line xLEN. A straightforward approach to do the filtering operation would be: However, many processors dont like the index calculations, so it is sometimes advantageous to do less index calculations. Heres how it goes (suppose LEN is divisible by four. As stated above, the trick basically also works for other factors): I had pretty good result with this on a SPARC. DSP Trick: Filtering in QAM transmitters and receivers Name: Filtering in QAM transmitters and receivers. When NOT to do what the textbooks tell you to do. Category: Hardware architecture, or implementation Application: QAM receivers (with hardware emphasis) Advantages: The textbook descriptions of QAM receivers sometimes miss practical details. quotOptimalquot solutions may not be the best ones. These tricks are simply a list of possible reasons for deviating from quotnormalquot QAM filter design. Introduction: (what the textbooks tell you to do) Any modem which modulates a linear channel (AM, ASK, FM, FSK, PM, PSK, BPSK, QAM, QPSK, or even baseband signalling) subject to noise will use filtering to improve the error rate in the receiver. In general, there will be filters on the output signals (tx) and the input signals (rx), and also the bit in the middle (the channel). There are two parts to this: Eliminate ISI (Inter Symbol Interference) due to limitations in the frequency or phase response of the channel. Use matched filtering to produce a maximum likelihood receiver. 1. ISI can be eliminated if the channel (including tx and rx filters) frequency response is (1) linear phase, and (2) has symmetry about a point at half the symbol rate (Fs2). a here is actually alpha - the rolloff factor. (Although I have seen (1alpha) used instead of alpha.) Alpha can be between 0 and 1, but commonly this will be 0.3 to 0.5 (or 1.3 to 1.5 using the other definition.) for 30 to 50 excess bandwidth For some reason (because the maths isnt too hard), most implemenations use a quotraised cosinequot response. The rolloff section between (1-a)middotFs2 and (1a)middotFs2 is actually a half cycle of a cosine wave. Note: it is also possible to use an adaptive equaliser in the receiver (either before or after the symbol decisions are made) which can reduce ISI. But this is quotsimplyquot a filter which adapts its response so the above requirement is met. Adaptive equalisers are used when the channel response is unknown or changing. They may either quotadaptquot to a training sequence and then remain fixed (like a fax machine), or they continuously adapt. 2. A matched filter will produce the lowest errors in the receiver output for a channel which adds white gaussian noise (an AWGN channel) if the rx filter impulse response is the time inverse of the tx pulse shape. (The tx pulse shape is determined by the tx filter.) In the frequency domain, this means that the magnitude responses of the rx and tx filters are the same, but the phase responses are opposite (and the combination has zero phase (linear phase in practice)). The matched filter output is only valid at the symbol sampling instant. (This was inherent in the maths. If you want to know more, look at a textbook .) For example, if we transmit square pulses, then the rx filter should have a square impulse response. This would be an integrate-and-dump filter. 3. Combining 1 and 2 results in the following: An optimal modem will use root-raised cosine filtering in the tx and rx filters. (A root-raised cosine filter puts quothalfquot the response in the tx and quothalfquot in the rx filter, so that the product in the frequency domain is a raised cosine.) The total channel reponse will have zero ISI, and the tx and rx filters are the same, so we have minimised the probability of errors. The Tricks The above description can be found in any communications textbook. Now for what the textbooks leave out: some examples of when not to use quotoptimalquot filters. Must meet transmit spectral mask because: Certain regulatory bodies place restrictions on the tx spectrum from a modem. For RF modems, the out-of-band emissions sometimes have to be lt -80dBc. Sometimes, the tx signal will interfere with the rx signal at the same end of the link in nearby channels. This is known as NEXT (Near End Cross Talk). In the case of an RF modem, the tx signal can be more than 100dB stronger than the rx signal, so NEXT can be a big problem. Both of these place limits on the tx filter. This will entail: Using a small alpha. Truncating the tails of the tx filter frequency response. This will result in degraded performance. Truncate the rx filter reponse as well. Using a non-root-raised cosine tx filter. Pick one that allows a sharper rolloff. Allocating more of the raised cosine filter to the tx, and less to the rx Interfering signal has non-white spectrum. (AWGN assumption was made in the matched filter derivation.) Known narrowband interferers can be handled by putting a notch in the rx filter. If the notch is very narrow, the tx filter neednt be changed. Adjacent channel interference can be handled by making the rx filter slightly narrower. (See Trick 1 above) Symbol timing recovery problems. A matched filter produces a maximum likelihood estimate of the input symbol at a particular instant only. This assumes that this instant is known. Some simpler symbol-timing recovery schemes may require sub-optimal filtering to work. For example, wideband rx and tx filters allow signal transition detection to be used for symbol timing recovery. (This is how a UART works.) Symbol timing recovery is usually easier with larger alpha. (Books could be written about symbol-timing recovery. Any takers) When one of the filters cannot be controlled. Perhaps the receiver uses analog filtering only, possibly in a SAW filter in the IF (passband) or RLC filter at baseband (BTW, 2nd and 3rd order butterworth have been used here). This filter will only be rough approximation for a root-raised-cosine, and will not have a linear phase response. This can be compensated for in the (FIR) tx filter. When there are significant non-linearities (in the tx output amplifier). Usually, the requirement will be to have the smallest amount of AM in the tx, which allows the average output power to be higher for a given amount of spectral spreading (due to the non-linearity). This may require wider tx filters and narrower rx filters. Useful where power efficiency is important (satellite links, handheld equipment, etc). There is also a case for using a larger alpha here. In extreme cases, it is possible to pick a modulation scheme that has a constant-amplitude constellation. (OQPSK, GMSK, etc.) When the rx filter is inside a feedback loop controlling carrier phase or frequency tracking. The group delay of the rx filter limits the tracking bandwidth of these loops (due to stability considerations). If a wider loop bandwidth is required (perhaps because of capture range or perhaps poor phase noise performance in the up - and downconverters), then the rx filter may need to be changed if it is not possible to move it outside the loop. In this case, allocate more of the raised cosine filter to the tx, and less to the rx (or try harder to move it outside the loop). DSP Trick: Using Parks-McClellan to Design a Non-Linear Phase FIR Filter It is possible to use the Parks-McClellan algorithm to design FIR filters with non-linear phase response. For example, a FIR filter with the equivalent response of a Butterworth filter can be designed using the P-M routine. First, take a common Butterworth description like that in Parks and Burrus where H(x) is a complex function. Create two PM input grids using the real and imaginary components of the Butterworth response. Use PM (or quotremezquot or whatever its called on your favorite system) to design two FIR filters using the respective input grids, but turn the Hilbert switch on for the one derived from the imaginary component. Sum the results, i. e. add together the nth coefficients of each filter to create a single N-tap filter. The resulting FIR filter (assuming youve done your job to make sure everything converges) will have the desired response from the original expression used to generate the PM input grids. Function Approximation Tricks In DSP, the exact value of a mathematical function usually isnt needed: a degree of inaccuracy usually can be tolerated, and computational speed usually is a primary concern. The right combination of accuracy and speed is very much application-specific. Approximation of mathematical functions, therefore, is an important subject in DSP. Highly accurate approximations are well known. However, here we present some less-well known approximation DSP tricks which provide an outstanding combination of speed and accuracy. DSP Trick: Magnitude Estimator Name: Magnitude Estimator Application: Signal strength measurement, AM demodulation, etc. Advantages: This estimation algorithm is very quick compared to calculating magnitude to full precision using a square-root operation. Given a complex number represented as quotI jQquot, the magnitude is: sqrt(I2 Q2). Unfortunately, the square-root operation in this formula is inherently slow and complicated to calculate, either in software or in hardware. For applications which do not require a full-precision magnitude value, the use of a magnitude estimation can save calculations. This well-known and widely used algorithm is a true gem of DSP because it provides considerable savings in calculation, at the cost of only a minimal loss of accuracy. Given a complex number whose real part is quotIquot and whose imaginary part is quotQquot, the algorithm estimates the magnitude as: Alpha max(I, Q) Beta min(I, Q) quotAlphaquot and quotBetaquot are two constants whose values can be chosen to trade among RMS error, peak error, and implementation complexity. The absolute value operations folds the complex number into the range of 0-90 degrees, and the min, max operations further fold the complex number into the range of 0-45 degrees. Within this limited range, a linear combination of I and Q are a good approximation of magnitude. Values for Alpha and Beta: A program to demonstrate and test this algorithm is given at bottom. It includes a table of the most useful values for Alpha and Beta. The program prints out the following: If you need a more accurate estimation than this algorithm provides, you can use some variation of it. For example, varying values of Alpha and Beta can be taken from a small lookup table, driven by the relative size of min and max values. Another possibility is to use this estimate as the quotseedquot of an iterative magnitude estimator. As an alternative, consider using the CORDIC algorithm, especially in hardware applications. This algorithm is described in Understanding Digital Signal Processing by Richard G. Lyons Lyo97. in Digital Signal Processing in Communication Systems by Marvin E. Frerking Fre94. and elsewhere. Thanks to Clay S. Turner for providing some of the coefficients. DSP Trick: Quick-and-Dirty Logarithms Name: Quick and dirty logarithms Application: Needs fairly precise logarithm of a value quickly. Advantages: Very fast, very little computation. Look up table is small for precision to well under a dB. Compact hardware implementation. Works for arbitary logarithm bases. Disadvantages: Precision limited by table size. Requires normalized floating point input. Introduction: Logarithms are usually computed by using a taylor series or another iterative algorithm. This takes up valuable clock cycles or hardware. Such algorithms are also usually limited to a specific logarithm base. This trick takes advantage of the normalization and the exponent in floating point representations. The Trick: Floating point representation of a number separates the number into an exponent (usually in excess notation), a sign and a significand, also known as a mantissa. The number represented is then NM2E. The log (in whatever base is convenient) of that number is LOG(N)LOG(M 2E)LOG(M) ELOG(2). If we assume M is normalized, 1ltMlt2, then 0 ltLOG(M) ltLOG(2). The LOG of the exponent gives us the coarse estimate of the LOG (to 6dB), which can be found by just multiplying the exponent by a constant (LOG(2) in the appropriate base). For IEEE floating point, a constant offset may need to be added to the exponent to correct for the excess 128 notation. If finer precision is required, and heres the real trick, then we can obtain an estimate of the logarithm of the mantissa and add that to the logarithm of the exponent to get a more accurate estimate. The logarithm of the mantissa can be found using a small look-up table addressed by the most significant bits of M (the most significant bit is always 1 if M is normalized, so that bit need not be used in the address). The more bits of M used, the larger the table, and the more accurate the logarithm. A single bit from M will get you close to 3dB, while a 5 bit address (32 entry table) will get close to 14 dB accuracy, which is usually all that is needed. This trick works well in hardware (FPGA) implementations, since the table size is kept small enough to be implemented in one logic cell. For hardware implementations, it may be convenient to use the exponent to address a table instead of using a multiplier. DSP Trick: Fixed-Point Atan2 With Self Normalization Name: Fast fixed-pt. atan2 calculation with self normalization Application: Used when one wants to compute the 4-quadrant arctangent of a complex number (or any number with x-y coordinates) with a self-normalizing function. Example Applications: digital FM demodulation, phase angle computations Computing a 4-quadrant arctangent on DSPs has been the subject of many discussions. Several techniques such as table lookup and polynomial expansion are well known. In fixed-point DSPs, some normalization of the complex number may be necessary, effectively implementing a hard limiter or amplitude invariance function. In fact, computing: includes the necessary normalization, but in a fixed-pt. DSP, the division can result in values outside the fixed-pt. range of -1,1). Also, for certain applications, such as digital FM demodulation, any amplitude fluctuations must be removed before computing the phase angle. I computed a self-normalizing ratio depending on the quadrant that the complex number resides in. For a complex number z, let xRe(z) and yIm(z). For a complex number in quadrant I, compute the ratio: To get the phase angle, compute: Likewise, if the complex number resides in quadrant II, compute the ratio: And to get the quadrant II phase angle, compute: If it turns out that the complex number was really in quad IV instead of quad I, just negate the answer resulting from (2). Likewise, do the same if the number was in quad III instead of quad II. By doing this, you have a 4-quadrant arctan function. The max error using equations (2) or (4) is a little less than 0.07 rads (only at a few angles though). The accuracy of the estimator is actually quite good considering using a 1st-order polynomial to estimate the phase angle. If you use a higher degree polynomial, it turns out that the even powers of the poly will disappear (due to the odd function), thus relaxing some of the computational load. QUICK NOTE FOR BETTER ACCURACY: To obtain better accuracy (a max error of .01 rads), one can replace equations (2) and (4) with: equations (2a) or (4a) can be computed using 2 MACs, which does not involve much more computation for a 7x increase in accuracy. Here is some C pseudocode (not optimized in any fashion) using equations (1)-(4): DSP Trick: Simultaneous Parabolic Approximation of Sin and Cos Name: Simultaneous parabolic approximation of sin and cos Application: When you need both sin and cos at once, and you need em fast, and using multiplications and parabolic approximation is OK, try this. Possible applications are audio panning, mixing fader, maybe even realtime filter coefficient calculations and 2D3D rotation transformations. Advantages: Cheap, only one or two multiplies per approximation pair. No discontinuities. A quarter of a sinusoid cycle is approximated with a parabola. The remaining quarters are horizontally and vertically flipped versions of the approximated quarter. Instead of creating two different approximations, the same polynomial is used for both sin and cos. The positive crossing point of sin(angle) and cos(angle), at anglepi4, is made to correspond to x0 in the polynomial. This shifts the center of a quarter at x0 and turns switching between quarters (and between sin and cos) into x and y sign flips. The range that is approximated is: Angle and x are related by: The approximation: (quot quot stands for quotapproximately equalsquot) As you see, the only difference is in the last sign, so you can calculate the part left from that first and then add or sub x to get sin or cos. For different angle ranges, you have to flip signs of the whole equation or the sign of the x term. See the example source code. c is a constant that can be fine-tuned for different applications. With c yet undefined, the polynomials hit 0 and 1 in the right places. Here are some differently optimized (and approximated) values for c: To compare the errors produced by different choices of c, we look at the maximums and minimums of the following error measures, for different c: The different c were optimized as follows: A) was optimized for minimum maximum absolute difference to sin. B) was optimized for minimum maximum absolute difference of sqrt(sinapprox(x)2cosapprox(x)2) to 1. This is important for example in a rotation transformation, where you want the dimensions to stretch as little as possible from the original. Note, though, that C) gives the lowest total magnitude quotwobblingquot range. C) was optimized similarly to B but never lets sqrt(sinapprox(x)2cosapprox(x)2) exceed 1. This is useful if you calculate filter coefficients and dont want unstable poles. Also, sinapprox(0) and cosapprox(0) give sqrt(2)2, which is the correct value. D) was optimized for continuous differential, which reduces high harmonics. This is good if you are creating sine and cosine signals rather than doing quotrandom accessquot to the function. Also, it eliminates the other multiplication, making the algo one-mul and low bit-depth: DSP Trick: Square Root Computation Name: Square root computation Category: Algorithmic Trick Application: e. g. Magnitude computation Advantages: Simple and fast Once in a while the square root of data has to be computed on a DSP. A method that comes to mind is polynomial approximation of the square root function. A much simpler method, however is the usage of Newtons method or, if division is a problem, successive approximation. 1) Newtons method: Newtons method states that if you want to find the zero of a function f(x) you may start at some guessing point x1 and compute the next guessing point for the zero x2 according to In the next step make x1 : x2 and repeat equation (1) etc. until the difference between x1 and x2 is sufficiently small. Newtons method does not alway converge, but if it does, it converges fast. In the special case of the square root computation Newtons method is guaranteed to converge. Lets say you want to compute x sqrt(z) then make If we compute f(x) 0 we immediately see, that x must be the square root of z. Now plug (2) into (1) to get which is the recursive equation to be used. The starting value for x1 is not critical but the closer it is to the real zero the better. I usually use x1 z. 2) Successive approximation: If division is a problem, then successive approximation might be the right choice to compute sqrt(x). Successive approximation basically does a binary search to find the square root. A little C-style pseudocode might best explain how it is done: Again, there might be better choices for the starting point but the one given is safe. DSP Trick: Polynomial Evaluation via Horner039s Rule Name: Polynomial Evaluation Category: Algorithmic Trick Application: e. g. Polynomial approximation of a transcendental function Advantages: Simple and fast Introduction: When evaluating a polynomial it is advantageous to use Horners rule as this nicely fits the MAC architectures of DSPs. Suppose you want to compute a polynomial: Horners rule to compute this polynomial is given by: or in a little C-snippet another, even better possibility is: Data Conversion Tricks DSP Trick: Fast Floating-Point to mu-Law Conversion Name: Fast floating point to mu-law conversion Application: When you need to convert audio data to mu-law and dont have a lot of time to mess around. Advantages: Very Fast (I implemented this in a seven cycle loop on a Sharc processor). Introduction: This trick is based upon the happy coincidence that mu-law compressed data is very much like a poor mans floating point format. Mu-law is a companding method fully descried in the ITU specification G.711. I believe this algorithm to be fully compliant. The Trick: The algorithm is performed in a few steps. The steps are described below. Although I have implemented and tested this approach in assembly on a Sharc, I am not at liberty to post the code (I do not own it). This approach will work when the data is already in floating-point format as per IEEE 754. Other floating point formats (i. e. Texas Instruments) may work as well, but will require adaptation. The input data is expected to range from -1.0 to 1.0. I present a C algorithm, which will not be fast, but should get the basic idea across. DSP Trick: Gray Code Conversion Name: Binary Gray Code Conversion Application: Some sensors send information in Gray code. These must be converted to binary in order to do arithmetic with it. Occasionally, it is necessary to convert back. Advantages: Higher speed or smaller code than other ways Ive seen. (A neat way to do this is elusive enough that Ive seen it done with a look-up table.) Introduction: The by-the-book conversion of Gray to binary is O(N-1), where N is the word length. One of my algorithms is O(log(N)-1), where N is the word length rounded up to a power of two. The other is O(N-1) (including N-1 subroutine calls), but the code is very compact, especially if binary-to-Gray is also needed. A Gray code is one in which adjacent numbers differ by one symbol. There are many Gray Codes, even in binary. They can be devised in any base. When Gray (or Gray code) is used without specifying which one, what is meant is reflected Binary Gray. To convert binary to Gray, it is only necessary to XOR the original unsigned binary with a copy of itself that has been right shifted one place. That is easy to do with common instructions. The cannonical way to convert Gray to binary is to XOR the bits one at a time, starting with the two highest bits, using the newly calculated bit in the next XOR. Ugh I show two easier ways here. Robert Sherry wrote the actual C code. The function declarations make these shorts and the code assumes 16 bits you can change that. Miscellaneous Tricks DSP Trick: Complex Downconverters for Signals at Fs4 or 3Fs4 PREDate: Thu, 22 Apr 1999 02:52:42 GMT From: Allan Herriman ltallan. herriman. hates. spamfujitsu. augt Newsgroups: comp. dsp Subject: Re: DSP Tricks THIS WORK IS PLACED IN THE PUBLIC DOMAIN Name: Complex downconverters for signals at Fs4 or 3Fs4 Category: Hardware architecture Application: Use for QAM modem receivers in FPGAs. Dont use if the local oscillator needs to be frequency agile. Advantages: This trick produces a trivially simple fixed frequency complex downconverter without needing an NCO or sine lookup tables quotClassicalquot modem receiver architecture using complex baseband processing: The X are multipliers. Typically, the FIR lowpass filters will be decimating types if the signal bandwidth is much less than the sample frequency, Fs. Polyphase filters may also be used here to resample the signals at the symbol rate (or 2x the symbol rate, etc) if this is not an integer submultiple of Fs. If the local oscillator isnt required to have a controllable frequency or phase, and it is possible to centre the input signal around Fs4 or 3Fs4, then the hardware can be dramatically simplified. Local oscillator outputs at Fs4: Cos: 1, 0, -1, 0, 1, 0, -1, etc. Sin: 0, 1, 0, -1, 0, 1, 0, Since we only need to multiply by 0, -1 or 1, the multiplier is trivial. Every second input to each filter is 0, so the filters only need to run at Fs2. (In this case, we only need to multiply by -1 or 1.) The multiplier can be removed altogether, and the - performed in the filter, either by twiddling the coefficients or by telling the accumulator to subtract. Since the Cos and Sin terms are never non-zero at the same time, it may be possible to to use just one FIR filter, designed to handle IQ interleaved data. This filter will have two accumulators which alternate between input samples. There are filter chips designed to do this, such as the HSP43168 from Harris. (Although there are better chips for new designs. ) This trick also potentially saves routing in FPGAs. Note: if this is a QAM receiver, then a separate carrier phase correction stage after the lowpass filters will be required. Also, any frequency errors in the input signal will be present during filtering. The solution is to: Tolerate this problem (after quantifying its effects). Use an AFC loop which controls the frequency error before downconversion. Dont use this trick - use an NCO as the LO. DSP Trick: Sinusoidal Tone Generator Name: Sinusoidal tone generator Application: If they need to generate a continuous tone of specific frequency and amplitude. Advantages: Fast and accurate. Ive seen this trick in a few different places, although never the (very simple) deriviation. It is based on the z-transform for sin(wn). Taking the inverse z-transform: Solving for the initial conditions (start at n1 since y0 and y-1 are so trivial to compute): where Ft is the tone frequency and Fs is the sampling frequency. For example, to generate a 1 kHz tone with a sampling frequency of 8 kHz: Note that all calculations were done with 64-bit floating point and rounded by hand. The z-transform of this shows two poles on the unit circle at - pi4 radians. Ive never encountered stability issues but care should be taken to evaluate quantization effects on the system. DSP Trick: Fast Floating Point to Mu-Law Conversion DSP Trick: Fast Floating-Point to mu-Law Conversion Name: Fast floating point to mu-law conversion Application: When you need to convert audio data to mu-law and dont have a lot of time to mess around. Advantages: Very Fast (I implemented this in a seven cycle loop on a Sharc processor). Introduction: This trick is based upon the happy coincidence that mu-law compressed data is very much like a poor mans floating point format. Mu-law is a companding method fully descried in the ITU specification G.711. I believe this algorithm to be fully compliant. The Trick: The algorithm is performed in a few steps. The steps are described below. Although I have implemented and tested this approach in assembly on a Sharc, I am not at liberty to post the code (I do not own it). This approach will work when the data is already in floating-point format as per IEEE 754. Other floating point formats (i. e. Texas Instruments) may work as well, but will require adaptation. The input data is expected to range from -1.0 to 1.0. I present a C algorithm, which will not be fast, but should get the basic idea across. DSP Trick: Fixed-Point DC Blocking Filter with Noise-Shaping Name: Fixed-Point DC Blocking Filter With Noise-Shaping Application: Used anytime DC offsets need to be removed (audio level metering or nearly any audio signal processing to avoid clicks). Since AD converters and their front end circuitry cannot be expected to be totally DC free, this is useful partly to insure that silence is equavalent to zero. Advantages: Utterly wipes out DC without introducing its own DC Introduction: The use of a digital differentiator along with a leaky integrator (essentially a one-pole LPF) to accomplish DC blocking is nothing new. It is essentially a 1st order HPF. Differentiator: ynxn - xn-1 Leaky Integrator: ynpoleyn-1 xn (0 lt 1-pole ltlt 1) if pole1, then it is a non-leaky integrator and completely undoes the differentiator. However, doing this with a fixed-point DSP (such as the 56K) introduces a couple of problems. First the order of operations has to be considered. Leaky Integrator first followed by differentiator: Since the differentiator truly wipes out DC no matter what the numerical issues are, this has the advantage that no DC gets into the output. The disadvantage is that if the pole is very close to 1 (which is necessary if you want your DC blocker to just block DC and other very low frequencies), the the gain of the leaky integrator blows up at low frequencies, enough that saturation is vitually assured and the post differentiation will not fix that horrible distortion. Differentiator first followed by leaky integrator: DC is killed in the first stage and the gains at low frequecies are reduced enough to guarantee that the integrator does not saturate. Also, there is no quantization error introduced by the differentiator so there isnt the problem of the integrator boosting quantization noise at low frequencies. The disadvantage is that the integrator creates its own DC problems due to quantization (rounding or truncating down) and limit cycling. This limit cycling happens when the amount that yn is reduced by multiplying by pole is equal to 12 LSB and rounding returns yn1 back to its previous non-zero value yn. it gets stuck on a non-zero value that gets measurably large as pole gets close to 1. We use the 2nd option above (differentiator first) and deal with the limit-cycling problem using error-shaping or noise-shaping with a zero on DC (Randy Yates called this quotfraction savingquot). By feeding back the quantization error that occurs in the one-pole LPF (the leaky integrator), one can design an error-to-output transfer function to have a desired frequency response (to literally shape the noise or error spectrum to steer noise away from where you dont want it to where you can tolerate it). With a zero of this noise transfer placed right on z1 (or at DC) we force the amplitude of the error in the output to be zero at the frequency of 0 (at the expense of increasing the error amplitude at Nyquist). We literally will have infinite SN ratio at DC. Therefore if no DC goes into the LPF (and the differentiator sees to that), then no DC comes out. Even if the quantization is not rounding to nearest but always rounding down (definitely a DC bias here) any DC introduced gets killed by the error shaping (this is what happens with fraction saving). I got this down to 3 instructions per sample in a 56K (using sample buffering, another trick, and pipelining) but here is what it might look like using C code: DSP Trick: Dealing With Propagating Truncation Errors Name: Dealing with propagating truncation errors. Category: Algorithmic tricks. Application: When values are truncated, and the truncated values are used later in the algorithm, ultimately corrupting the output. Advantages: You get an acceptable output without having to switch to a completely different algorithm, and generally without having to sacrifice too much execution time. Introduction: When you truncate or round the value of, say, a 32-bit product register to 16 bits, you may wind up getting pesky little rounding artifacts due to the reduced precision. Although it isnt a problem in most applications, sometimes the small rounding errors do propagate through subsequent stages of an algorithm and eventually corrupt the output. Here are a couple of suggestions that can help you get a cleaner output. Use extended-precision arithmetic, such as larger-width multiplies and add-with-carry operations, but thats computationally expensive. I think this is the most common way to kill those pesky errors that begin to accumulate. Processor support for extended-precision arithmetic includes: add with carry and subtract with borrow multiplication of signedsigned, signedunsigned, and unsignedunsigned operands Create quotleakage. quot This means that at strategic logactions in an algorithm you multiply with (1-epsilon) so that a value continously becomes slightly smaller than it was supposed to do. If you do that in a feedback loop, the errors that are feeding back will fade out. Dither the signal. You may find instability caused by a limit cycle appearing for zero (i. e. smaller magnitude than one LSB) or constant input. Or, an algorithm may quotstallquot because an input signal is too weak to excite the variables in an algorithm. Both problems may be eliminated by dithering the variables in the algorithm. You do that by adding white noise to the variables. In Handbook of Digital Signal Processing: Engineering Applications Ell87. Douglas F. Elliot discusses quoterror feedbackquot. As far as I remember, this is a technique where you essentially quotsavequot the truncation error of a previous iteration and add it in the next iteration, effectively introducing some redundancy. This redundancy effectively creates extended precision for you with less computational effort. If everything gets out of hand, have some error detection mechanism built into the algorithm (say, to check for magnitude of a certain variable) and re-initialize your algorithm by resetting coefficients or what else you can think of resetting. Digital Signal Processing Tutorials Digital Signal Processing is a difficult and complex subject. Here, we offer tutorials to clear up some of the mysteries of DSP. Quadrature Signals: Complex, But Not Complicated Understanding complex numbers and quadrature signals is essential for understanding DSP at both a theoretical and a practical level. Yet this strange, complex subject (based on the admittedly imaginary construct of the square root of negative one ) is among the hardest for DSP beginners to grasp - and is confusing at times even for advanced DSPers. But dont despair: help is on the way. In this tutorial, Rick Lyons. author of the best-selling DSP books Understanding Digital Signal Processing and Streamlining Digital Signal Processing: A Tricks of the Trade Guidebook . clears the fog around this difficult subject by providing the clearest, most intuitive explanation yet of quadrature signals and their importantance in Digital Signal Processing. QuadSignals (200K, pdf) Version 2, January 2008 Cascaded Integrator-Comb (CIC) Filter Introduction In the classic paper, quotAn Economical Class of Digital Filters for Decimation and Interpolationquot, Hogenauer introduced an important class of digital filters called quotCascaded Integrator-Combquot, or quotCICquot for short (also sometimes called quotHogenauer filtersquot). Here, Matthew Donadio provides a more gentle introduction to the subject of CIC filters, geared specifically to the needs of practicing DSP designers: A Little MLS (Maximum-Length Sequence) Tutorial A Little MLS Tutorial by Robert Bristow-Johnson A Maximum-Length Sequence (MLS) has two different (but related) definitions: One is the driving function applied to the input of a linear time invariant (LTI) system: The other definition is simply the binary sequence, an 0 or 1, used in the exponent. It is clear that xn or - X and that its RMS and peak values are both X, making its crest factor (peakRMS) equal to 1, the lowest it can get. This is why MLS is as noise-immune (for broadbanded noise) as you can get. In comparison, the other popular measurement method, Linearly Swept Frequency measurements, has a crest factor of sqrt(2) which is good but not quite as good as MLS. Also, the autocorrelation of xn is (N is defined later.) It is clear that The value of Rxn for n 0 is determined later. The sequence an is generated from a shift register exclusive-or (XOR) operation using the K bit word An which is akn are the bits of the word and an can be chosen to be any of the K bits but, for simplicity, well choose ana0n, the LSB. The shift and XOR operation is explicitly for 0 lt k lt K and it is understood that aKn is always zero. pk are the K most significant bits of the Kth order quotprimitive polynomialquot, P, (K1 bits) which is a specially chosen constant. Now it is clear that An is a function of its previous state, An-1 and the primitive polynomial, P. Since A has K bits, there are 2K possible bit permutations and conceivably An can have 2K possible states before the sequence repeats. But it is clear that the zero state must map only to the zero state, no matter what P is. So we define an to be an MLS and P to be a primitive polynomial if . starting with a nonzero state for An, all other nonzero states of An are taken before An gets back to the original state and the sequence of An states repeats. There are 2K - 1 nonzero states so the MLS would have length of 2K - 1 (if you exclude the zero state, thats as long as it gets) which we now define to be N-1 (or N2K). A few bit combinations for P will result in An being an MLS and other bit combinations will result in An returning to any given state before N-1 shift XOR operations. Clearly the MSB of P, pK, must be 1 or you immediately reduce the number of An states by 12. Okay, if you pick on any bit of An, particularly the LSB, a0n (or an), you will see that there are exactly N2 quot1quot bits and N2 - 1 quot0quot bits because the zero state is not part of the An sequence. So there is one more quot1quot bit to an than quot0quot bits and there is one more sample that xn is -1 than 1 for each cycle of the MLS. Now, heres the nontrivial part: if one takes an MLS, ai, which is a circular or repeating sequence, and XOR that with a shifted copy, ani, you will get either the zero sequence (if n0), or the very same MLS circularly shifted a completely different shift delay, ami. That is This is because which says the very same rule that generates the MLS, ai, is the rule that governs the sequence: ai XOR ain. That says the XOR sequence must either be the zero sequence (what happens when n 0) or the same MLS (possibly circularly shifted to some other delay amount). Now, what this says is that the autocorrelation defined above is because when n is not 0, the SUM has N2 quot-1quot terms and (N2 - 1) quot1quot terms resulting in one extra quot-1quot term. where dn is the periodic unit impulse function So, except for a little DC bias, xn has the same autocorrellation as white noise if N is large enough. Now, to make your MLS measurement, you squirt some MLS at your target and cross-correlate the result against all delayed versions of the same MLS yn is the output of your LTI: where hn is the impulse response. If the impulse response is much shorter than the MLS length N-1, than the only term in the left SUM we have to count is the m 0 term, resulting in This says that, except for a small and negative DC offset, the result of the cross-correlation is the impulse response of the system scaled up by the energy of the driving MLS function. From the impulse response, everything else about the LTI system can be computed (frequency response, etc.) A note about usage: MLS drives the input with a period function of length N-1. This causes quottime aliasingquot in the resulting measurement which is also periodic with the same period. To avoid problems choose N to be at least twice as long as the expected length of the impulse response (a problem of circular logic requiring you to know something about the impulse response before you measure it). The other necessary measurement issue is that you must drive your system with two concatenated cycles of the MLS, the first one to excite the system into a steady state and the second to make the complete impulse response measurement. Whats wrong with MLS MLS has truly weird behavior when there are small nonlinearities. now remember, linearity and time-invariancy is assumed when you are trying to measure frequency response using any method but some methods work better than others in the presence of nonlinearity. The MLS that is applied to the system under test can be represented as: where an0 or 1 and is the LSB (or any single bit) of the shift register sequence (with exclusive-OR in the feed back path) that the computer science guys like to call a maximum length sequence. for clarity, i will call xn an quotMLSquot and an an quotMLS bit sequencequot. Bboth are periodic, with period N-12K - 1, where K is the number of bits in the shift register word. Now, one thing that is shown in the tutorial is that if you take the MLS bit sequence, an, and exclusive-OR it against a circularly shifted version of itself, you get another copy of an but shifted by some other, seemingly random, amount. that is: Restated slightly differently although, strictly speaking, k does depend on j, its essentially a psuedo-random dependence. given an i and j (j not0), k could be any wild number between 1 and N-1. For now just push that fact onto your stack (well pop it off later). MLS measurement errors come about when there are nonlinearities (the tutorial explains how, for a perfectly linear, time-invarient system, MLS measures your system impulse response). in a 1995 letter to the AES, some guy named Matthew Wright, had the insight to explain why these spurious and randomly delayed spikes were getting added to the measured impulse response. If the system is modeled as a Volterra series (which is a pretty general way to model a nonlinear, non-memoryless system) you will get some cross-product terms that look like: Now, those nonlinear cross-products can be manipulated a little: That means the nonlinear cross-product term ( someCoefxn-ixn-i-j ) is gonna look just like the input sequence but delayed by some wild value, ki, and scaled by someCoef. So the measured impulse response will have an impulse delayed by ki and scaled by someCoef. That is where you can get problems in the impulse response and problems in the frequency response. Now, since this behavior is deterministic and repeatable (even though it looks like a random delay), you can repeat the measurement and average until the cows come home (or the cliche of your choice), and this problem will not go away. There are techniques for dealing with it (like try different MLSs based on different primitive polynomials and median filtering) but averaging the response using the same MLS wont help. References Douglas D. Rife and John Vanderkooy, quotTransfer-Function Measurement with Maximum-Length Sequencesquot, Journal of the Audio Engineering Society, Vol. 37, Number 6 pp. 419 (1989). This article presents a comprehensive analysis of transfer-function measurement based on maximum-length sequences (MLS). MLS methods employ efficient cross correlations between input and output to recover the periodic impulse response (PIR) of the system being measured. John Vanderkooy, quotAspects of MLS Measuring Systemsquot, Journal of the Audio Engineering Society, vol 42, no 4, (Apr 94). Matthew Wright, quotComments on Aspects of MLS Measuring Systemsquot, Journal of the Audio Engineering Society, vol 43, no 1, (JanFeb 95). Multipath Channel Model Using DSP Multipath distortion is a common problem in many DSP-based data transmission systems. Here, Neil Robertson shows how to model multipath channels using complex-coefficient FIR filters. Reducing FFT Scalloping Loss Errors Without Multiplication Sum of Two Sinusoidal FunctionsFinancial The module is dedicated to finance. There are three main areas that are covered: risk measure and management, asset allocation, pricing. For what concerns the risk measure, some functions are dedicated to the computation of Value at Risk (VaR) and Expected Shortfall (ES). Backtest is also implemented in order to check the goodness of such risk measures. Both VaR and ES are also computed in an Extreme Value Theory framework (EVT). Furthermore, it is possible to estimate the parameters of the EVT density function (through maximum likelihood). The Mean Excess Function for graphical study of an EVT distribution is also implemented. The interest rate risk is faced by functions aimed at computing duration, convexity, and yield to maturity. Furthermore, Merton, Vasicek and Cox, Ingersoll and Ross interest rate models are implemented together with the estimation of their parameters. Parametric interpolation of the interest rate curve is possible through both Svennsons and Nelson-Siegels models. Finally, some technical analysis indicators are implemented: Bollinger bands, moving averages, Hurst index. The asset allocation problem is faced by two functions which compute: the optimal portfolio minimizing the variance of its return and the optimal portfolio minimizing the expected shortfall of its return. In both cases, the portfolios with and without a riskless asset and with and without short selling are computed. Pricing problem is approached through functions aimed at: computing the spread on Interest Rate Swaps, computing the value of options in the Black and Scholes framework (with Greeks and implied volatility), simulating stochastic processes (through Euler discretization). backtest. Apply the backtest to Expected Shortfall, Value at Risk and a Linear Spectral risk measure. bollinger. Plots the historical prices, the Bollinger bands, and the b-percentage. bsgreeks. Compute the Greeks for Black and Scholes put and call options. bsimpvol. Compute the implied volatility in a Black and Scholes framework. bsoption. Compute the value of both a call and a put option in a Black and Scholes framework. cfr. Compare and merge two or more time series according to dates. المدة الزمنية. Compute both duration and convexity of cash flows by using the yield-to-maturity. esvarevt. Compute both Expected Shortfall and Value at Risk. esvarlin. Compute Expected Shortfall, Value at Risk and a Linear Spectral risk measure on a set of assets. esvaroptim. Compute the optimal portfolio minimizing the Expected Shortfall. euler. Simulate the solution of a system of stochastic differential equation. evt. Estimate the parameters of the Generalized Pareto Distribution. gbm. Estimate the parameters of a Geometric Brownian Motion. hedge. Compute the hedge ratio between an asset and a derivative on that asset. hurst. Compute the Hurst index on historical prices. interest. Estimate the parameters of three spot interest rate models (Merton - Vasicek - CIR). مصلحة الضرائب. Compute both the spread and the value of the legs of a fix-for-floating Interest Rate Swap. markowitz. Compute the optimal portfolio minimizing the variance. mef. Compute and draw the Mean Excess Function. movav. Compute and draw the moving average of a given time series. nelsonsiegel. Estimate the parameters for the Nelson Siegel model of spot interest rates. svennson. Estimate the parameters for the Svennson model of spot interest rates.

Comments