25 Pages

june7

Course: ECE 2409, Fall 2009
School: Villanova University
Rating:
 
 
 
 
 

Word Count: 951

Document Preview

7, June `99 CHARACTERS AND STRINGS: Going Beyond Numbers 1999 BG Mobasseri 1 06/11/09 WHAT DO WE WANT TO DO? x MATLAB is first and foremost a "numerical" computation platform x In practice, however, there are many occasions where one has to work with characters or alpha-numeric quantities 1999 BG Mobasseri 2 06/11/09 EXAMPLES x Here are a few examples: placing titles and labels on...

Register Now

Unformatted Document Excerpt

Coursehero

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
7, June `99 CHARACTERS AND STRINGS: Going Beyond Numbers 1999 BG Mobasseri 1 06/11/09 WHAT DO WE WANT TO DO? x MATLAB is first and foremost a "numerical" computation platform x In practice, however, there are many occasions where one has to work with characters or alpha-numeric quantities 1999 BG Mobasseri 2 06/11/09 EXAMPLES x Here are a few examples: placing titles and labels on graphs working with file names such as day1.dat, day2.dat, etc. comparing two strings, one user supplied and one in the library decimal to binary string conversion 1999 BG Mobasseri 3 06/11/09 CHARACTER ARRAY x How does MATLAB define a character array? x Any expression enclosed inside single quotes is converted to a character array u=`villanova' u is defined as a 1x9 character array taking up 18 bytes 1999 BG Mobasseri 4 06/11/09 OTHER FORMS x All the usual MATLAB conventions apply. Type these out and see u=[`villanova','university'] is a 1x19 array u=[`charles';'richard']. Check size of u u=[`villanova';'university']. Does this work? why 1999 BG Mobasseri 5 06/11/09 STRING COMPARISON x One of the key operations performed on character arrays is string comparison x Take s1=`ece 2290' s2=`ece 4790' c=strcmp(s1,s2) x c=0 means s1 and s2 are not equal. c=1 means they are 1999 BG Mobasseri 6 06/11/09 PARTIAL COMPARISON x It is possible to do partial matching, say, the first 3 characters c=strncomp(s1,s2,4) x The result of this comparison will be c=1, indicating that the first 4 positions are the same 1999 BG Mobasseri 7 06/11/09 RELATIONAL OPERATORS x Relational operators (==,<=, >=) can be applied to character arrays s1=`james' s2=`jenny' s1==s2 returns a binary array with 1's pointing to positions of equality x In one statement find out in how many positions do s1 and s2 differ? 1999 BG Mobasseri 8 06/11/09 SEARCHING FOR A STRING x We can find the occurrence of a string by using findstr label=`villanova' position=findstr(`nova',label) x findstr points to the beginning position of the string. Here, position=6 1999 BG Mobasseri 9 06/11/09 REPLACING A STRING x We can replace the occurrence of a string using strrep strrep(label,'vill','Vill') x Try changing Bill Clinton to William Clinton using strrep 1999 BG Mobasseri 10 06/11/09 NUMBER/STRING CONVERSION x Sometimes we need control over individual digits x Take n=2290 m=int2str (n) x As a result, m becomes a 1x4 array with m(1)=2. You can set, for example, m(2)=3 1999 BG Mobasseri 11 06/11/09 Explore! x Let's set n=`2290'. If you type n, you will get 2290 but this is not the same as two thousand two hundred 90. x Define m=`2409' and do n+m. What do you get and why? 1999 BG Mobasseri 12 06/11/09 LABELING PLOTS AT RUNTIME x Sometimes plot labels are not known before execution x For example, plot title should say... voltage ranges from 5 to 9 volts. The problem is these numbers determined are at runtime x How do we pass 5 and 9 to the title command at runtime? 1999 BG Mobasseri 13 06/11/09 Takes input from keyboard Try it! Predefined function in MATLAB Convert xmax to string Form a long string to go in the title command 1999 BG Mobasseri 14 06/11/09 MIXING STRINGS AND NUMBERS x Let's say we want to create a text string that says temperature plot:4pm to 6pm x Call the string s s=[`temperature plot:',int2str(4),'pm to `,int2str(6),'pm'] 1999 BG Mobasseri 15 06/11/09 TITLING A PLOT: TRY IT x The following code inserts a parameter, determined at runtime, in a graph title for i=1:4 f=i;% pick a frequency x=cos(2*pi*f*t); %signal to plot figure(i);%number figures plot(t,x);grid; s=['a sinusoid of frequency ',int2str(f),' Hz'];%construct title title(s) end 1999 BG Mobasseri 16 06/11/09 SAVING LARGE NUMBER OF FILES AT ONCE x In many situations your code generates a large number of files which you want them saved, each under a different name, like datafile1.mat datafile2.mat etc 1999 BG Mobasseri 17 06/11/09 ILLUSTRATING WHAT WE WANT x Say we want to generate 10 sinusoids each at a different frequency then save them to individual files t=0:0.01:1; for f=1:10 x=cos(2*pi*t*f); save datafile x end 1999 BG Mobasseri 18 x What we really want save statement to do is save datafile1 x save datafile2 x save datafile3 x ... 06/11/09 SOLUTION:eval x eval(s) evaluates string s as if it was an explicit MATLAB statement typed in the command window x For example, eval(`plot(x)') is equivalent to plot(x) 1999 BG Mobasseri 19 06/11/09 CUSTOMIZING STRING AT RUNTIME x First, put together the string piece by piece. Here we want the filename appended by the loop index, i.e. datafile1, datafile...

Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Villanova University - ECE - 2409
June 1, `99ADVANCED MATRIX OPERATIONS PART IIADVANCED SUBSCRIPTINGqqYou can pick out the elements of an array A using another array Define a=[1 2 3;4 5 6;7 8 9], v=[1 3]qWhen you see a(:,v) read it like this all the rows of a but columns defined
Villanova University - ECE - 2409
June 4, `99MATLAB GRAPHICS - PART IIADVANCED PLOTTING 1999 BG Mobasseri106/11/093-D PLOTTINGqThere are numerous ways to display a function in 3-D in black and white as well as color One way to interpret 3D data is a series of points in space given
Villanova University - ECE - 2409
ECE 2409 Fundamentals of MATLABSummer `99 Distance Learning Program1999 BG Mobasseri15/7/99Course organizationq q q&quot;Class&quot; meets every other day On days off you do practice and homework Lecture notes are named after the day they are offered, like m
Minnesota - CHEM - 8021
Chemistry 5021/8021 Computational Chemistry Practice Notes for insightII and Discover.Spring, 2005Note: In the following, words/phrases in bold font imply left-mouse click that particular function. Indented texts indicate subcommands of the previous fun
Lake County - ECE - 445
Guitar Training HardwareGroup 22 Karan Singh &amp; Bryan Yocom ECE 445 Senior Design April 23, 2007Introduction Inspiredby the popular &quot;Guitar Hero&quot; series of games available on the PlayStation 2 and XBOX360. a game that works like &quot;Guitar Hero&quot;, but uses
Washington - CHEM - 456
SYLLABUS, POLICIES AND PROCEDURESLectures: M, W, F, 9:40 AM 10:40 AM, Bagley 260Instructor: E-mail: Home Page: Office Hours: Prerequisites: Office: Professor Gary Drobny BAG 126 Office 685-2052 drobny@chem.washington.edu T l h http:/faculty.washington.e
Clarkson - ME - 537
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt; &lt;Error&gt;&lt;Code&gt;NoSuchKey&lt;/Code&gt;&lt;Message&gt;The specified key does not exist.&lt;/Message&gt;&lt;Key&gt;3128a7f2bc64c1e8b5710386fb83afa928f0f93a.doc&lt;/Key&gt;&lt;RequestId&gt;C 3960E6F3964DB65&lt;/RequestId&gt;&lt;HostId&gt;FZQGxJwYq+hNEdKIwt/K4UE9cZIJWfZQ
Clarkson - ME - 637
ME 637 Project 2: PARTICLE TRANSPORT AND DEPOSITION Brownian Diffusion in Turbulent Duct FlowsSpring 2003a) Point Source: Consider a turbulent flow between two parallel plates that are 2 cm apart. Assume that a point source located at different location
Clarkson - ME - 637
ME 637 APPLICATIONSProject 3: APPLICATIONSSpring 2003Analyze a realistic flow and particle transport project of practical interest. Discuss with the instructor your selected project. Examples are: a) Flow around a car and dispersion from exhaust. b) Fl
Clarkson - ME - 326
ME 326, Exam 2, Spring 04, Average=73.56Number of Students420 50 55 60 65 70 75 Grades 80 85 90 95 100
Clarkson - ME - 326
ME 326, Exam 1, Spring 04, Average=746Number of Students420 50 55 60 65 70 75 Grades 80 85 90 95 100
Clarkson - ME - 326
ME 326G. AhmadiOutline Stream Fuction/Potential Function Irrotational Flows Simple Flows (Source/Sink Flows, Vortex, Doublet) Flow SuperpositionME 326G. AhmadiContinuityGiven a V = 0 =02IrrotationalityGiven a V = 0 =02ME 326G. AhmadiStre
Clarkson - ME - 639
Chaos ProjectElizabeth KenneyJuly 29, 2002Abstract For this project, the Lorentz Model was studied. The equilibrium states and the stability of these equilibrium states were examined. Numerical experiments were performed and a periodic solution and a c
Clarkson - ME - 639
ME 6391)HW Set 3Find the transport equation for the Reynolds stress tensor u i u j . Organize the terms in the form of production, dissipation and diffusion. Evaluate the order of magnitude of the terms in stress transport equation.Uo2)For an axisym
Clarkson - ME - 639
ME 639 Part 1: Duct FlowFLOW SIMULATION, PROJECT-2Spring 2008Develop a grid and analyze the developing flow in a channel, which is 2 cm wide and 11 cm long for an air velocities in the range of 0.1 to 10 m/s. a) For smooth side walls evaluate the veloc
Clarkson - ME - 639
ME 6391)HW # 2(Problem 1.3, Tennekes and Lumley) Large eddies in turbulent flows have a length scale and a time scale t () = / u. The smallest eddies have a length scale of , a velocity scale of ) , and time scale . Estimate the characteristic velocity
Clarkson - ME - 639
ME 639SIMULATION OF CHAOS, PROJECT-1Spring 2008Select a nonlinear deterministic dynamical system for detail analysis. 1. Study the equilibrium states and periodic orbit solutions. (Analyze the stability of the equilibrium states.) 2. Perform numerical
Clarkson - ME - 326
ME 326G. Ahmadi Compressible Flow Regimes Thermodynamics Mach Number Speed of Sound Isentropic Flows with Area Change Variations with Mach number Shock Waves Nozzle and Diffusers Flows with Friction Flows with Heat TransferME 326G. AhmadiFlows with F
Clarkson - ME - 326
ME 326G. Ahmadi Compressible Flow Regimes Thermodynamics Mach Number Speed of Sound Isentropic Flows with Area Change Variations with Mach number Shock Waves Nozzle and Diffusers Flows with Friction Flows with Heat TransferME 326G. AhmadiME 326G. Ah
Clarkson - ME - 326
ME 326G. Ahmadi Compressible Flow Regimes Thermodynamics Mach Number Speed of Sound Isentropic Flows with Area Change Variations with Mach number Shock Waves Nozzle and Diffusers Flows with Friction Flows with Heat TransferME 326G. AhmadiEnergy Equat
Clarkson - ME - 326
ME 326G. Ahmadi Compressible Flow Regimes Thermodynamics Mach Number Speed of Sound Compressible Flows with Area Change Variations with Mach number Shock Waves Nozzle and Diffusers Flows with Friction Flows with Heat TransferME 326G. AhmadiMach Numbe
Clarkson - ME - 326
ME 326G. AhmadiOutline ME 326Stream Function Vorticity Velocity Potential Irrotational Flows Flow NetG. AhmadiIncompressible Fluid Cartesian Coordinates Define Stream Functionr u v V = + =0 x y u= y v= xG. AhmadiME 326 2 u v 2 + = 0 x y x y x
Clarkson - ME - 326
ME 326G. AhmadiME 326Outline Irrotational Flows Simple Flows Source/Sink Flows Vortex Flows Doublet Flows Flow Superposition Flow over a CylinderG. AhmadiEuler Equation ContinuitydV = g p cfw_ cfw_ dt Body Force Pr essure ForceGiven a Irrotational
Clarkson - ME - 326
ME 326G. AhmadiOutline ME 326Flows Past Immersed Bodies Boundary Layer Flows (laminar) Blasius Solution Momentum Integral Method Turbulent Boundary Layer FlowsG. AhmadiUoUol / l &lt; 1G. AhmadiLaminar Boundary LayerME 326Boundary Layer Thicknes
Clarkson - ME - 326
ME 326G. AhmadiME 326G. AhmadiOutline ME 326Forces and Toques Drag of Spheres Drag of Cylinders Drag Coefficient for 2D Objects Drag Coefficient for 3D Objects Lift Force for an AirfoilG. AhmadiME 326G. AhmadiDrag Force CD = 1 2 V A 2C D = C D
Clarkson - ME - 326
ME 326G. AhmadiOutline Cartesian Coordinates Cylindrical Axial Flows Cylindrical Rotating FlowsME 326G. AhmadiIncompressible Fluidu u u u p 2u 2u 2u ( + u +v + w ) = g x - + ( 2 + 2 + 2 ) t x y z x x y z 2v 2v 2v p v v v v + ( 2 + 2 + 2 ) + w ) = g
Clarkson - ME - 326
ME 326G. AhmadiOutline Conservation of Mass Balance of Momentum Navier-Stokes EquationME 326G. AhmadiIncompressible Fluid Cartesian Coordinatesr u v w + = V = 0 + x y zPolar Coordinatesr 1 ( rv r ) v V = [ + ]=0 r r ME 326G. Ahmadiy yy + yy y
Clarkson - ME - 326
ME 326G. Ahmadi4Constant Coefficient Equations 4Euler Equation 4Total Differentials 4Separable EquationsME 326G. AhmadiConstant Coefficient Equationsd y dy + 2 - 8y = 0 2 dx dxSolution2Boundary Conditionsx = 0, y = 1 x = , y = 0y = AeME 326mx
Clarkson - ME - 326
ME 326-Fluid MechanicsG. AhmadiME 326-Fluid MechanicsG. AhmadiME 326-Fluid MechanicsG. AhmadiME 326-Fluid MechanicsG. AhmadiME 326-Fluid MechanicsG. AhmadiPumps Compressors Wind TurbinesME 326-Fluid MechanicsG. AhmadiME 326-Fluid MechanicsG.
Clarkson - ME - 437
ME 437/537-ParticleG. AhmadiAerosols are suspension of solid or liquid particles in a gas. Dust, smoke, mists, fog, haze, and smog are common aerosols. Aerosol particles are found in different shapes.ME 437/537-ParticleG. AhmadiEquivalent area diamet
Clarkson - ME - 437
ME 437/ME 537PARTICLE TRANSPORT, DEPOSITION AND REMOVALGoodarz Ahmadi Department of Mechanical and Aeronautical Engineering Clarkson University Potsdam, NY 13699-57251Air pollution and smog.Particle trajectories in a hot gas filtration vessel.2Samp
Clarkson - ME - 326
Clarkson - ME - 326
ME 326FLOW SIMULATION, PROJECT-1Spring 2004Part 1: Duct Flow Develop a grid and analyze the developing flow in a channel, which is 2 cm wide and 11 cm long. a) For an air velocity of 0.1 m/s, compare the velocity profile with the exact laminar flow sol
Clarkson - ME - 326
ME326 - INTERMEDIATE FLUID MECHANICS Spring 2004 Textbook: Fluid Mechanics, F.M. White, McGraw-Hill Book Co., Special Edition. (Part of 5th ) Instructors: G. Ahmadi (CAMP 267, 268-2322) Office Hours: MTW 2:20 - 4:00 p.m. Course Site: http:/www.clarkson.ed
UCCS - ECE - 3610
Set #1Due Monday February 2, 2004Make note of the following:ECE 3610 Homework Problems Papers are due at the start of class Write only on one side of the paper Please try if possible to start each new problem on a clean sheet of paper Use engineering
UCCS - ECE - 3610
ECE 3610 Engineering Probability and StatisticsSpring Semester 2004Instructor:Mark Wickert Office: EB-226 wickert@eas.uccs.edu http:/eceweb.uccs.edu/wickert/ece3610/Phone: 262-3500 Fax: 262-3589Office Hrs: Required Texts: Study Guides Optional Softwa
University of Scranton - CS - 341
Project Name Use Case Specification: Create AccountName Brief Description Actor(s) Flow of Events Basic Flow This use case starts when the User accesses the sign in feature of the system. 1. The system prompts the User for his/her username and password.
UVA - FR - 245
Timber Harvesting - 5Logging System Planning The successful implementation of any specialized logging system is dependent upon successful planning. With a specialized logging system, it is possible to do a more efficient job under particular conditions.
Northeastern University - COM - 1355
Copyright 2000 William D ClingerModified March 2002 by William D Clinger*Outline of lecture. pitfalls of benchmarking importance of code improvement (optimization) examining the code generated by a compiler disassembly delayed branch instructions
George Mason - M - 322
Homework # 7Hand-in (Due Wednesday, April 22 - 3pm): Sec. 6.1 - 9a, 11, 18 Sec. 6.2 - 6 Additional Problems: Sec. 6.1 - 1, 2, 5, 8, 10 Sec. 6.2 - 1, 7, 9, 14
George Mason - M - 322
Homework # 6Hand-in (Due Wednesday, April 1 - 3pm): Sec. 5.1 - 14 Sec. 5.2 - 18a Sec. 5.4 - 17 (Hint: Consider the charactersitic polynomial of A), 18a, b Additional Problems: Sec. 5.1 - 1, 2b,c, 3a,b, 8, 11, 17 Sec. 5.2 - 1, 2a,b,d, 3a,
George Mason - M - 322
Homework # 4Hand-in (Due Friday, March 6 - 3pm): Let T be the map from R^2 to itself, given by perpindicular projection onto the line y = mx. Find the matrix of T with respect to the standard basis. (Hint: Do this by first finding a basis of R^2 such
George Mason - M - 322
Homework # 5Hand-in (Due Monday, March 23 - 3pm): Sec. 4.2 - 8, 25 Sec. 4.3 - 12, 14 Additional Problems: Sec. 4.2 - 1, 5, 6, 26, 27 Sec. 4.3 - 1, 10, 15, 20
George Mason - M - 322
Homework # 3 There is no hand-in homework. Additional Problems: Sec. 2.4 - 1,3,6,14,16,22 Sec. 2.5 - 1,2,5,6a,b,c,9, 10
George Mason - M - 322
Homework # 2Hand-in (Due Monday, Feb. 16 at 3pm): Sec. 1.6 - 15, 34a Sec. 2.1 - 14a, 15 Additional Problems: Sec. 1.6 - 1, 2,3,5, 6, 10a, 11, 12, 13,14,17 Sec. 2.1 - 1,2,3,5,9,10,16,17,18
George Mason - M - 322
Homework # 1Hand-in (Due Monday, Feb. 2 at 3pm): Sec. 1.2 - 18 Sec. 1.3 - 12 Sec. 1.4 - 10 Sec. 1.5 - 14Additional Problems: Sec. 1.2 - 1, 11, 12, 13,14,17, 21 Sec. 1.3 - 1, 2, 5, 8, 9,19, 20 Sec. 1.4 - 1,2,7,8 Sec. 1.5 - 1, 2,4,6,8, 11,
Bellarmine - CS - 699810
Venti: a new approach to archival storageSean Quinlan and Sean Dorward Bell Labs, Lucent Technologies AbstractThis paper describes a network storage system, called Venti, intended for archival data. In this system, a unique hash of a blocks contents act
Grinnell College - CS - 151
Today in 151: Symbols and ListsOverview:* What is a symbol?* What is a list?* Lab* ReflectionAdministrivia:* Eschew obfuscation* Any thoughts on the Eboards?* Do you mind visitors from other classes? (Other 151, 153, 195)* Homework 1 due + Th
Langston - CS - 699810
NFS Version 3 Design and ImplementationBrian Pawlowski Chet Juszczak Peter Staubach Carl Smith Diane Lebel David Hitz AbstractThis paper describes a new version of the Network File System (NFS) that supports access to files larger than 4GB and increases
UNL - PSYCH - 941
Power, Effect Size &amp; Sample Size* r? ? power .20 .30 .40 .50 .60 .70 .80 .90 .10 124 208 .15 32 93 .20 21 53 74 95 143 167 191 255 .25 15 34 47 60 90 105 120 160 .30 14 24 33 42 62 72 82 109 .35 13 18 24 30 45 52 59 78 .40 11 14 19 23 34 39 44 58 .45 9 11
CSB-SJU - BIOL - 106
Grading Rubric for Class Leadername_ date _General _ _ _ _ _ _ _ _ Arrives five minutes before class (1 pt) Music selected &amp; started (1 pt) Greeting of the day selected on overhead (1 pt) Ready as time-keeper; i.e., has gong (1 pt) Checks that the atten
CSB-SJU - BIOL - 106
Plants and Human Affairs Biology 106name _Plant Portrait1. Scientific Name: _ 2. Common Name: _ 3. Family name (technical):_ 4. Family Name (common): _ 5. Growth habit: tree 6. Part(s) of plant used: 7. Description of economic uses: shrub herb vine8.
Syracuse - CSE - 681
Architecture of the Ultimate Extensible Distributed SystemJim Fawcett CSE681 Software Modeling and Analysis Fall 2006Your Assignment Your supervisor just handed you a spec forimplementation of: Distributed system with universal connectability using
Salisbury - ASTRO - 108
Stellar DeathLecture ElevenFate of StarsSalisbury UniversityThe Fate of StarsIf you recall from our discussion about the birth of modern astronomy, Tycho observed a bright new star in the heavens that lasted for Luminosity a few weeks in 1572 A.D. th
Harvey Mudd College - PHYSICS - 516
Genetic Algorithms and the Traveling Salesman ProblembyKylie Bryant Arthur Benjamin, AdvisorAdvisor:Second Reader: (Lisette de Pillis)December 2000 Department of MathematicsAbstractGenetic Algorithms and the Traveling Salesman Problem by Kylie Brya
Salisbury - ASTRO - 108
Stellar FormationThe Fate of the SunThe Main SequenceAt the core, main-sequence stars are all very much alike. All main-sequence stars convert hydrogen into helium by the nuclear fusion processes of PP Chain (lower mass stars) or the CNO Cycle. This is
Salisbury - ASTRO - 108
Stellar FormationLecture NineThe Stellar BirthSalisbury UniversityThe Formation of StarsStars are born in regions of high-density interstellar clouds. (I.S.M.)I.S.M. (Inter-Stellar Medium)Two phases: Gaseous 99% of ISM 1. Largely Hydrogen (~73%) 2.
Salisbury - ASTRO - 108
The StarsLecture EightThe Heavenly StarsSalisbury UniversityThe Properties of StarsEven with the naked-eye, the night sky is strung with bright pinpoints of light we call &quot;stars.&quot; Along with a dark night sky the unaided eye can easily pick out a few
Salisbury - ASTRO - 108
The SunLecture SevenThe SunSalisbury UniversityThe SunThe PhotosphereThe visible surface of the sun. Thin layer of gas (less than 500km deep) from which we receive the majority of the Suns light. Average surface temperature ~ 6000K The photosphere i
Salisbury - ASTRO - 108
Atoms &amp; StarlightLecture SixAtoms &amp; StarlightSalisbury UniversityAtoms and StarlightWe have already concluded that stars are very much distant objects. The great gulf of distance between the stars and our own solar system makes the study of stars, th
Salisbury - ASTRO - 108
Light &amp; TelescopesLecture FiveLight &amp; TelescopesSalisbury UniversityThe most exciting phrase to hear in science, the one that heralds the most discoveries, is not &quot;Eureka!,&quot; but &quot;That's funny.&quot; - Isaac AsimovThe Electromagnetic SpectrumIn the 1860s,