## Monday, January 18, 2010

### DSP Tutorial #4: Plotting Complex Signals

In this example we will plot a more complex time domain signal in Matlab:

```clear all; %clear all variablesfs = 50; % sample freqTs=1/fs; % sample periodn=0:1*fs; % time window (fs=samples per second), 1 secondtn=n*Ts; % sample indexsig_a=cos(2*pi*5*tn);sig_b=1.5+cos(2*pi*20*tn);x=sig_a+sig_b;% Time domain plot of x(t)=cos(2*pi*5*tn)figure('Color',[1 1 1]);h=plot(tn,x,'g','LineWidth',3);box off;hold on;plot(tn,sig_a,'--r','LineWidth',2);plot(tn,sig_b,'--k','LineWidth',2);title('Example of Composite Signal: 2 Signals Added');legend('Composite','Signal 1','Signal 2');xlabel('Time(s)');ylabel('Amplitude');figure('Color',[1 1 1]);plot(tn,sig_a);title('Stem Plot Example: Fs = 50 (50 Points)');axis('tight'); ```
``` Posted by James Eastham at 9:38 AM ```
``` No comments: Post a Comment ```
``` ```
``` ```
``` Newer Post Older Post Home Subscribe to: Post Comments (Atom) window.___gcfg = { 'lang': 'en' }; ```
``` ```
``` ```
``` About Twitter Linkin Profile With my bikes 2008 (2008 Ninja250 & 1974 Ducati Mark3 450) Contact Info RFWarrior@yahoo.com Tech Posts: Electronics LM741 Datasheet Thick Lines in LTSpice Modeling diode breakdown in LTSpice Temp Sweeps in LTSpice - Part I Temp Sweeps in LTSpice - Part 2 Modeling LM741 Slew Rate in LTSpice Exporting LTSpice Data NE5532 LTSpice Model LM741 LTSpice Model LTSpice Introduction LM741 Datasheet VCVS Modeling in LTSpice Parameter Sweeps: .step Grading Rubric Tech Posts (DSP and Comm) Matlab Interpolation Compute Spectrum Function Foruier Additivity Plotting Normal Distributions Fourier Transform for Dummies Matlab: Random Numbers Simple FM Modulator for LTSpice Receiver Sensitivity RF Link Budget Creating a Terrain Profile DSP Tutorial #1: Basic Plots DSP Tutorial #2: Signal Creation DSP Tutorial #3: Sum of Sinusoids DSP Tutorial #4: Complex Signals DSP Tutorial #5: Frequency Analysis DSP Tutorial #6: Looping DSP Tutorial #7: Audio Processing DSP Tutorial #8: Spectrum Function DSP Tutorial #9: Basic digital filter DSP Tutorial #10: Windowing DSP Tutorial #11: Filters DSP: Sample Audio File (fp3.wav) DSP: WCDMA File (wcdma2.csv) DSP: Raw Stock Data File DSP: Obtaining Raw Stock Data DSP: Coherent Noise Averaging DSP: 3G WCDMA Windowing DSP: Noise Averaging WCDMA Technology Management Super Cruncers Book Review LP Compensation Technical Presentation Tips Effective Team Leadership Papers LP Compensation (IEEE) Mantech - Yield Mgmt. WCDMA Noise Averaging RF Shielding Considerations IS-95a Capacity Analysis Temp Controlled V_Source DTV Optimization My Groups Moto 68HC12 LTSpice 902MHz Group Excel Training Installing Solver 2007 History of Microsoft Excel Extended ASCII Key Codes Excel (Office) Shortcut Keys Excel Training Workbook Excel Training - Warmup.xls Excel Training - Activity2-3.xls Excel Training - Activity8-16.xls Educational Links eeweb forums PSU Blackboard My PSU My OIT Tom Almy Forums Tom Almy's Site Raw MOV videos (ms.pdx.oit.edu) Videos (Mediaview) OIT Portland LTSpice Videos LTSpice WebCT Dr. Aboy Moodle OIT Moodle Other Links RF Cafe Agilent Educator Corner EDA Boards RCR IEEE Blog Archive May (1) November (1) September (1) October (1) May (1) April (1) February (1) January (1) December (1) November (2) October (2) September (3) July (1) March (1) November (1) October (3) September (1) August (1) May (4) April (5) February (8) January (9) November (2) October (1) August (1) June (1) April (1) January (2) December (1) October (3) March (2) February (2) January (1) ```
``` ```
``` ```
``` ```
``` ```
``` Free Counters Awesome Inc. theme. Powered by Blogger. ```
``` ```
``` ```
``` ```
``` window.setTimeout(function() { document.body.className = document.body.className.replace('loading', ''); }, 10); window['__wavt'] = 'AOuZoY4F9PTJ6Qk7mtJ2etVBVd2MtLX_iA:1508456266643';_WidgetManager._Init('//www.blogger.com/rearrange?blogID\x3d5732015422208460018','//jeastham.blogspot.com/2010/01/dsp-tutorial-4-plotting-complex-signals.html','5732015422208460018'); _WidgetManager._SetDataContext([{'name': 'blog', 'data': {'blogId': '5732015422208460018', 'title': 'James Eastham', 'url': 'http://jeastham.blogspot.com/2010/01/dsp-tutorial-4-plotting-complex-signals.html', 'canonicalUrl': 'http://jeastham.blogspot.com/2010/01/dsp-tutorial-4-plotting-complex-signals.html', 'homepageUrl': 'http://jeastham.blogspot.com/', 'searchUrl': 'http://jeastham.blogspot.com/search', 'canonicalHomepageUrl': 'http://jeastham.blogspot.com/', 'blogspotFaviconUrl': 'http://jeastham.blogspot.com/favicon.ico', 'bloggerUrl': 'https://www.blogger.com', 'hasCustomDomain': false, 'httpsEnabled': true, 'enabledCommentProfileImages': true, 'gPlusViewType': 'FILTERED_POSTMOD', 'adultContent': false, 'analyticsAccountNumber': '', 'encoding': 'UTF-8', 'locale': 'en', 'localeUnderscoreDelimited': 'en', 'languageDirection': 'ltr', 'isPrivate': false, 'isMobile': false, 'isMobileRequest': false, 'mobileClass': '', 'isPrivateBlog': false, 'feedLinks': '\x3clink rel\x3d\x22alternate\x22 type\x3d\x22application/atom+xml\x22 title\x3d\x22James Eastham - Atom\x22 href\x3d\x22http://jeastham.blogspot.com/feeds/posts/default\x22 /\x3e\n\x3clink rel\x3d\x22alternate\x22 type\x3d\x22application/rss+xml\x22 title\x3d\x22James Eastham - RSS\x22 href\x3d\x22http://jeastham.blogspot.com/feeds/posts/default?alt\x3drss\x22 /\x3e\n\x3clink rel\x3d\x22service.post\x22 type\x3d\x22application/atom+xml\x22 title\x3d\x22James Eastham - Atom\x22 href\x3d\x22https://www.blogger.com/feeds/5732015422208460018/posts/default\x22 /\x3e\n\n\x3clink rel\x3d\x22alternate\x22 type\x3d\x22application/atom+xml\x22 title\x3d\x22James Eastham - Atom\x22 href\x3d\x22http://jeastham.blogspot.com/feeds/5124693180597103183/comments/default\x22 /\x3e\n', 'meTag': '', 'openIdOpTag': '', 'adsenseHostId': 'ca-host-pub-1556223355139109', 'adsenseHasAds': false, 'ieCssRetrofitLinks': '\x3c!--[if IE]\x3e\x3cscript type\x3d\x22text/javascript\x22 src\x3d\x22https://www.blogger.com/static/v1/jsbin/35781802-ieretrofit.js\x22\x3e\x3c/script\x3e\n\x3c![endif]--\x3e', 'view': '', 'dynamicViewsCommentsSrc': '//www.blogblog.com/dynamicviews/4224c15c4e7c9321/js/comments.js', 'dynamicViewsScriptSrc': '//www.blogblog.com/dynamicviews/3a5f158fdcfd6ef9', 'plusOneApiSrc': 'https://apis.google.com/js/plusone.js', 'sharing': {'platforms': [{'name': 'Get link', 'key': 'link', 'shareMessage': 'Get link', 'target': ''}, {'name': 'Facebook', 'key': 'facebook', 'shareMessage': 'Share to Facebook', 'target': 'facebook'}, {'name': 'BlogThis!', 'key': 'blogThis', 'shareMessage': 'BlogThis!', 'target': 'blog'}, {'name': 'Twitter', 'key': 'twitter', 'shareMessage': 'Share to Twitter', 'target': 'twitter'}, {'name': 'Pinterest', 'key': 'pinterest', 'shareMessage': 'Share to Pinterest', 'target': 'pinterest'}, {'name': 'Google+', 'key': 'googlePlus', 'shareMessage': 'Share to Google+', 'target': 'googleplus'}, {'name': 'Email', 'key': 'email', 'shareMessage': 'Email', 'target': 'email'}], 'googlePlusShareButtonWidth': 300, 'googlePlusBootstrap': '\x3cscript type\x3d\x22text/javascript\x22\x3ewindow.___gcfg \x3d {\x27lang\x27: \x27en\x27};\x3c/script\x3e'}, 'hasCustomJumpLinkMessage': false, 'jumpLinkMessage': 'Read more', 'pageType': 'item', 'postId': '5124693180597103183', 'pageName': 'DSP Tutorial #4: Plotting Complex Signals', 'pageTitle': 'James Eastham: DSP Tutorial #4: Plotting Complex Signals'}}, {'name': 'features', 'data': {'lazy_images': 'false', 'unsupported_browser_message': 'false', 'lightbox_img_parsing': 'true', 'video_theatre_support': 'true', 'sharing_get_link_dialog': 'false', 'sharing_native': 'false'}}, {'name': 'messages', 'data': {'edit': 'Edit', 'linkCopiedToClipboard': 'Link copied to clipboard!', 'ok': 'Ok', 'postLink': 'Post Link'}}, {'name': 'template', 'data': {'name': 'Awesome Inc.', 'localizedName': 'Awesome Inc.', 'isResponsive': false, 'isAlternateRendering': false, 'isCustom': false, 'variant': 'dark', 'variantId': 'dark'}}, {'name': 'view', 'data': {'classic': {'name': 'classic', 'url': '?view\x3dclassic'}, 'flipcard': {'name': 'flipcard', 'url': '?view\x3dflipcard'}, 'magazine': {'name': 'magazine', 'url': '?view\x3dmagazine'}, 'mosaic': {'name': 'mosaic', 'url': '?view\x3dmosaic'}, 'sidebar': {'name': 'sidebar', 'url': '?view\x3dsidebar'}, 'snapshot': {'name': 'snapshot', 'url': '?view\x3dsnapshot'}, 'timeslide': {'name': 'timeslide', 'url': '?view\x3dtimeslide'}, 'isMobile': false, 'title': 'DSP Tutorial #4: Plotting Complex Signals', 'description': 'In this example we will plot a more complex time domain signal in Matlab: clear all; %clear all variables fs \x3d 50; % sample freq Ts...', 'url': 'http://jeastham.blogspot.com/2010/01/dsp-tutorial-4-plotting-complex-signals.html', 'type': 'item', 'isSingleItem': true, 'isMultipleItems': false, 'isError': false, 'isPage': false, 'isPost': true, 'isHomepage': false, 'isArchive': false, 'isLabelSearch': false, 'postId': 5124693180597103183}}]); _WidgetManager._RegisterWidget('_NavbarView', new _WidgetInfo('Navbar1', 'navbar', null, document.getElementById('Navbar1'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_HeaderView', new _WidgetInfo('Header1', 'header', null, document.getElementById('Header1'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_BlogView', new _WidgetInfo('Blog1', 'main', null, document.getElementById('Blog1'), {'cmtInteractionsEnabled': false, 'useNgc': false, 'lightboxEnabled': true, 'lightboxModuleUrl': 'https://www.blogger.com/static/v1/jsbin/3532259065-lbx.js', 'lightboxCssUrl': 'https://www.blogger.com/static/v1/v-css/368954415-lightbox_bundle.css'}, 'displayModeFull')); _WidgetManager._RegisterWidget('_TextListView', new _WidgetInfo('TextList2', 'sidebar-right-1', null, document.getElementById('TextList2'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_ImageView', new _WidgetInfo('Image1', 'sidebar-right-1', null, document.getElementById('Image1'), {'resize': false}, 'displayModeFull')); _WidgetManager._RegisterWidget('_TextListView', new _WidgetInfo('TextList1', 'sidebar-right-1', null, document.getElementById('TextList1'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_LinkListView', new _WidgetInfo('LinkList10', 'sidebar-right-1', null, document.getElementById('LinkList10'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_LinkListView', new _WidgetInfo('LinkList8', 'sidebar-right-1', null, document.getElementById('LinkList8'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_LinkListView', new _WidgetInfo('LinkList9', 'sidebar-right-1', null, document.getElementById('LinkList9'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_LinkListView', new _WidgetInfo('LinkList3', 'sidebar-right-1', null, document.getElementById('LinkList3'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_LinkListView', new _WidgetInfo('LinkList7', 'sidebar-right-1', null, document.getElementById('LinkList7'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_LinkListView', new _WidgetInfo('LinkList4', 'sidebar-right-1', null, document.getElementById('LinkList4'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_LinkListView', new _WidgetInfo('LinkList1', 'sidebar-right-1', null, document.getElementById('LinkList1'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_LinkListView', new _WidgetInfo('LinkList5', 'sidebar-right-1', null, document.getElementById('LinkList5'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_BlogArchiveView', new _WidgetInfo('BlogArchive1', 'sidebar-right-1', null, document.getElementById('BlogArchive1'), {'languageDirection': 'ltr', 'loadingMessage': 'Loading\x26hellip;'}, 'displayModeFull')); _WidgetManager._RegisterWidget('_HTMLView', new _WidgetInfo('HTML1', 'footer-1', null, document.getElementById('HTML1'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_HTMLView', new _WidgetInfo('HTML2', 'footer-2-1', null, document.getElementById('HTML2'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_AttributionView', new _WidgetInfo('Attribution1', 'footer-3', null, document.getElementById('Attribution1'), {}, 'displayModeFull')); ```