Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING TASK 1 To identify the peripherals of a computer, components in a CPU and its functions. Draw the block diagram of the CPU along with the configuration of each peripheral. Computer – The word “computer “comes from the word “compute “which means to calculate. So a computer is normally considered to be a calculating device that performs arithmetic operations at enormous speed. A computer is an electronic device which is used to perform operation on raw data as per instruction given by user. They are 1) It accepts data or instructions through input, 2) It stores data, 3) It can process required data by the user, 4) It gives results as production, and 5) It controls all functions inside the computer Various Components of Computer Computer is an electronic device which performs tasks given by user with extremely fast speed and accuracy. Like any other device or machine, a computer system has also a number of parts. A computer system can be blocked into mainly three parts: IT WORKSHOP 2018 BATCH 1 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING 1. Input Unit 2. Central Processing Unit 3. Output Unit 1. Input unit – Input unit is a unit that accepts any input device. The input device is used to input data into the computer system. Function of input unit: 1. It converts inputted data into binary codes. 2. It sends data to main memory of computer . 2. Central Processing Unit (CUP) – CPU is called the brain of a computer. An electronic circuitry that carries out the instruction given by a computer program. CPU can be sub classified into three parts. i .Control unit (CU) ii. Arithmetic & Logic unit (ALU) iii.Memory Unit (MU) i. Control unit (CU)- the control unit manages the various components of the computer. It reads instructions from memory and interpretation and changes in a series of signals to activate other parts of the computer. It controls and co-ordinate is input output memory and all other units. ii. Arithmetic & Logic unit (ALU) – The arithmetic logic unit (ALU), which performs simple arithmetic operation such as +,-, *, / and logical operation such as >, <, =<, <= etc. iii. Memory Unit (MU)- Memory is used to store data and instructions before and after processing. Memory is also called Primary memory or internal memory. It is used to store data temporary or permanently. Function of CPU1. 2. 3. 4. 5. 6. 7. It controls all the parts and software and data flow of computer. It performs all operations. It accepts data from input device. It sends information to output device. Executing programs stored in memory It stores data either temporarily or permanent basis. It performs arithmetical and logical operations. IT WORKSHOP 2018 BATCH 2 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING 3. Output Unit –Output unit is a unit that constituents a number of output device. An output device is used to show the result of processing. Function of Output unit: 1. it accepts data or information sends from main memory of computer 2. It converts binary coded information into HLL or inputted languages. AIM: To identify the peripherals of a computer. Introduction to Computer Hardware: Hardware is the physical appearance of the devices or tools. It is what which we can touch and feel. Computer Hardware consists of the Monitor, CPU, Keyboard, Mouse and all other devices connected to the computer either externally or internally. The Mother Board There are primarily two types of motherboards, AT motherboard, and ATX motherboard. AT motherboards. The AT and ATX motherboards differ in the form factor. Full AT is 12" wide x 13.8" deep, and Baby AT is 8.57" wide x 13.04" deep. Full-ATX is 12" wide x 9.6" deep and MiniATX is 11.2" wide x 8.2" deep. Other major differences include power supply connector, and keyboard connector. AT has 5-pin large keyboard connector, whereas ATX has 6-pin mini connector. Similarly, AT has single row two connectors +/-5V, and +/-12V, whereas ATX motherboard has double row single connector providing +/-5V, +/-12V, and +3.3V. The important constituent components of an ATX Motherboard are given below: IT WORKSHOP 2018 BATCH 3 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING 1. Usb keyboard 2. Usb 3. Parallel port 4. Cpu chip 5. Ram slots 6. Floppy controller 7. Ide controller 8. Pci slot 9. Isa slot 10. Cmos battery 11. Agp slot 12. Cpu slot 13. Power supply plug in 1.Mouse & keyboard: Keyboard Connectors are two types basically. All PCs have a Key board port connected directly to the motherboard. The AT-style keyboard connector is quickly disappearing, being replaced by the smaller mini DIN PS/2-style keyboard connector. IT WORKSHOP 2018 BATCH 4 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING 2.USB (Universal serial bus): USB is the General-purpose connection for PC. You can find USB versions of many different devices, such as mice, keyboards, scanners, cameras, and even printers. a USB connector's distinctive rectangular shape makes it easily recognizable. USB has a number of features that makes it particularly popular on PCs. First, USB devices are hot swappable. You can insert or remove them without restarting your system. 3.Parallel port: Most printers use a special connector called a parallel port. Parallel port carry data on more than one wire, as opposed to the serial port, which uses only one wire. Parallel ports use a 25-pin female DB connector. Parallel ports are directly supported by the motherboard through a direct connection or through a dangle. 4.CPU Chip : The central processing unit, also called the microprocessor performs all the calculations that take place inside a pc. CPUs come in Variety of shapes and sizes.Modern CPUs generate a lot of heat and thus require a cooling fan or heat sink. The cooling device (such as a cooling fan) is removable, although some CPU manufactures sell the CPU with a fan permanently attached. 5.RAM slots: Random-Access Memory (RAM) stores programs and data currently being used by the CPU. RAM is measured in units called bytes. RAM has been packaged in many different ways. The most current package is called a 168-pin DIMM (Dual Inline Memory module). 6.Floppy controller: The floppy drive connects to the computer via a 34-pin ribbon cable, which in turn connects to the motherboard. A floppy controller is one that is used to control the floppy drive. 7.IDE controller: Industry standards define two common types of hard drives: EIDE and SCSI. Majority of the PCs use EIDE drives. SCSI drives show up in high end PCs such as network servers or graphical workstations. The IT WORKSHOP 2018 BATCH 5 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING EIDE drive connects to the hard drive via a 2-inch-wide, 40-pin ribbon cable,which in turn connects to the motherboard. IDE controller is responsible for controlling the hard drive. 8.PCI slot: Intel introduced the Peripheral component interconnect bus protocol. The PCI bus is used to connect I/O devices (such as NIC or RAID controllers) to the main logic of the computer. PCI bus has replaced the ISA bus. 9.ISA slot (Industry Standard Architecture): It is the standard architecture of the Expansion bus. Motherboard may contain some slots to connect ISA compatible cards. 10.CMOS Battery: To provide CMOS with the power when the computer is turned off all motherboards comes with a battery. These batteries mount on the motherboard in one of three ways: the obsolete external battery, the most common onboard battery, and built-in battery. 11.AGP slot: If you have a modern motherboard, you will almost certainly notice a single connector that looks like a PCI slot, but is slightly shorter and usually brown. You also probably have a video card inserted into this slot.This is an Advanced Graphics Port (AGP) slot 12.CPU slot: To install the CPU, just slide it straight down into the slot. Special notches in the slot make it impossible to install them incorrectly. So remember if it does not go easily, it is probably not correct. Be sure to plug in the CPU fan's power. 13.Power supply plug in: The Power supply, as its name implies, provides the necessary electrical power to make the pc operate. the power supply takes standard 110-V AC power and converts into +/-12-Volt, +/-5-Volt, and 3.3-Volt DC power. CPU (Processor) The central processing unit (CPU, occasionally central processor unit) is the hardware within a computer system which carries out the instructions of a computer program by performing the basic arithmetical, logical, and input/output operations of the system. IT WORKSHOP 2018 BATCH 6 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING SMPS (Switched mode Power Supply) A switched-mode power supply (switching-mode power supply, SMPS, or switcher) is an electronic power supply that incorporates a switching regulator to convert electrical power efficiently. Cabinet A computer cabinet is an enclosure with fitted, fixed or removable side panels and doors. The cabinet contains a computer rack for mounting computers or other electronic equipment. CPU heat Sink and fan A computer fan is any fan inside, or attached to, a computer case used for active cooling, and may refer to fans that draw cooler air into the IT WORKSHOP 2018 BATCH 7 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING case from the outside, expel warm air from inside, or move air across a heat sink to cool a particular component. RAM (Random Access Memory) RAM (random access memory) is the place in a computer where the operating system, application programs, and data in current use are kept so that they can be quickly reached by the computer's processor. RAM is much faster to read from and write to than the other kinds of storage in a computer, the hard disk, floppy disk, and CD-ROM. However, the data in RAM stays there only as long as your computer is running. When you turn the computer off, RAM loses its data. When you turn your computer on again, your operating system and other files are once again loaded into RAM, usually from your hard disk. HDD (Hard Disk Drive) The hard disk is housed inside the hard drive, which reads and writes data to the disk. The hard drive also transmits data back and forth between the CPU and the disk. IT WORKSHOP 2018 BATCH 8 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING FDD (Floppy Disk Drive) A floppy disk, also known as a floppy, diskette, or simply disk, is a type of disk storage composed of a disk of thin and flexible magnetic storage medium, sealed in a rectangular plastic enclosure lined with fabric that removes dust particles. Floppy disks are read and written by a floppy disk drive (FDD). CD-ROM Drive Short for Compact Disc Read-Only Memory, a CD-ROM is an optical disc that contains audio or software data whose memory is read-only. A CD-ROM Drive or optical drive is the device used to read them. CDROM drives have speeds ranging from 1x to 72x, meaning it reads the CD roughly 72 times faster than the 1x version. As you would imagine, these drives are capable of playing audio CDs and reading data CDs, including CD-R and CD-RW discs. IT WORKSHOP 2018 BATCH 9 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING CD Writer A CDROM (compact disk read-only memory), also written as CD-ROM, is a type of optical storage media that allows data to be written to it only once Different Screws Used AGP (Accelerated Graphics Port) Card Stands for "Accelerated Graphics Port." AGP is a type of expansion slot designed specifically for graphics cards. LAN (Local Area Network) card IT WORKSHOP 2018 BATCH 10 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING A network interface card (NIC) is a computer circuit board or card that is installed in a computer so that it can be connected to a network. Personal computers and workstations on a local area network (LAN) typically contain a network interface card specifically designed for the LAN transmission technology, such as Ethernet or token ring. IT WORKSHOP 2018 BATCH 11 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING TASK 2 Hardware Trouble shooting: Hardware trouble shooting of a PC which does not boot due to improper assembly or defective peripherals. Troubleshoot:1.If you hit the power button & nothing happened. Check all power connections. Check for power on mother board. 2.If the system turns on but does not beep or begin to boot up. Remove all components except motherboard/ cpu / mother check by giving power to them Beep codes: AMI BIOS 1 Beep: DRAM refresh failure 2 Beeps: Parity circuit failure 3 Beeps: Base 64K RAM failure 4 Beeps: System timer failure 5 Beeps: Processor failure 6 Beeps: Keyboard controller / gate A20 failure 7 Beeps: Virtual mode exception error 8 Beeps: Display memory read/write failure 9 Beeps: ROM BIOS checksum failure 10 Beeps: CMOS shutdown register read/write error 11 Beeps: Cache memory error Continuous Beeping: Memory or video problem AWARD BIOS 1 Long Beep: Memory problem 1 Long, then 2 Short Beeps: Video error IT WORKSHOP 2018 BATCH 12 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING 1 Long, then 3 Short Beeps: Video error Continuous Beeping: Memory or video problem IT WORKSHOP 2018 BATCH 13 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING TASK 3 Software Troubleshooting: Malfunctioning of CPU due to system software problems. Error messages encountered during boot before Windows loads Ensure that your computer BIOS settings are correctly configured to the hardware that is installed in your computer Error messages while windows loading 1.If you have recently installed or changed something that could have caused normal windows to stop loading, try loading the last known good configuration 2.If you are unable to get into Normal windows and believe that removing or uninstalling a program or changing a setting may help enable you to get into windows, boot the computer into windows XP safe mode 3.If your computer has worked fine in the past but recently has been experiencing the issue you are encountering run the system restore option to restore the computer to an earlier date Other error messages that occur while windows is loading or after windows is loaded 1. If error occur but windows still loads , verify no issues or conflict exists in device manager. 2.Ensure that if programs are loading automatically that these errors are not associated with these programs 3.Make sure Windows XP is up to date by checking Microsoft windows update page. 4.If your computer has virus protection installed make sure that it is up to date and that no virus are being detected 5.If your computer has worked fine in the past but recently has been experiencing the issue you are encountering run the system restore option to restore the computer to an earlier date. IT WORKSHOP 2018 BATCH 14 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Software Troubleshooting Steps 1.Close all open programs and dialog windows. 2.Restart the program and try to re-create the problem. 3.If the problem recurs, turn off the computer, let it rest for ten seconds and turn it on again. 4.Log on and try to re-create the problem. 5.If the problem recurs, did you change any configuration settings recently? If so, reverse the changes. 6.Did you install new hardware or software recently? Uninstall and try to re-create the problem. 7.If the problem recurs, record the exact sequence of actions and clicks that generated the unexpected results. Also describe in detail how the program reacted and why that reaction was abnormal or undesirable. 8.Finally, write down word for word the text of any error messages that you see. 9.Also write down the name of the computer that’s experiencing the problem. On most Windows machines, go to Start -> Run, and type in sysdm.cpl. Click on the Computer Name tab. Write down the full name of the computer. 10.Contact tech support. IT WORKSHOP 2018 BATCH 15 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING TASK 4 Students customize their web browsers with the LAN proxy settings, bookmarks, search tool bars and pop up blockers. Also, plug-ins like Macro-media Flash should be configured. Students should know what search engines are and how to use the search engines. A few topics would be given to the students for which they need to search on Google by using filters. LAN proxy settings: A proxy server is basically just another computer that sits between you and your ISP. It’s usually configured in corporate environments to filter web traffic going to and from employee computers. A LAN is a network limited to an area such as a home or small business that is used to interconnect devices. LAN settings can be configured to limit the number of devices that can be connected and what IP addresses those devices will receive. 1.Click the Start icon (or press the Start button on the keyboard), and then tap or click Settings. 2.Click Network & Internet. 3.Click Ethernet. 4.Click Change Adapter Options. 5.Right-click the connection that you want to configure and then choose Properties from the contextual menu that appears. 6.To configure the network adapter card settings, click Configure. 7.Review the list of connection items listed in the Properties dialog box. 8.If a protocol that you need isn’t listed, click the Install button to add the needed protocol. 9.To remove a network item that you don’t need (such as File and Printer Sharing for Microsoft Networks), select the item, and click the Uninstall button. IT WORKSHOP 2018 BATCH 16 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING 10.To configure TCP/IP settings, click Internet Protocol (TCP/IP); click Properties to display the TCP/IP Properties dialog box; adjust the settings; and then click OK. Pop-Up Blocker A pop-up blocker is software that prevents pop-up windows from appearing on a website. Some pop-up blockers work by immediately closing the pop-up window, while others disable the command that calls the pop-up window. Most browser software allows the user to turn the blocker on or off. Pop-ups are usually used by advertisers as a way to deliver ads, but they distract Web users from their experience and most consider them a nuisance. This is why pop-up blockers were developed and have become a part of most Web browsers. Including a pop-up blocker in browser software helps it to work more effectively, because the browser knows when a website is attempting to open a new pop-up window and just ignores that request. A pop-up blocker is also known as a pop-up killer. Bookmark: A bookmark is a saved shortcut that directs your browser to a specific webpage. It stores the title, URL, and favicon of the corresponding page. Saving bookmarks allows you to easily access your favorite locations on the Web. All major web browsers allow you to create bookmarks, though each browser provides a slightly different way of managing them. For example, Chrome and Firefox display your bookmarks in an open window, while Safari displays them in a list in the sidebar of the browser window. Internet Explorer uses the name "Favorites" to refer to bookmarks, and like Safari, it displays all your favorites in a list within the browser window sidebar. To create a bookmark, simply visit the page you want to bookmark and select Add Bookmark or Bookmark this Page from the Bookmarks menu. In Internet Explorer, you can click the star icon to open the Favorites sidebar and click Add to Favorites to add the current page to your bookmarks. The website title will show up in your bookmarks list along with the website's favicon if available. As your collection of bookmarks grows, you can create folders to organize your bookmarks into different categories. IT WORKSHOP 2018 BATCH 17 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Plugins: Plugins are software additions that allow for the customization of computer programs, apps, and web browsers; as well as the customization of the content offered by websites. While plugins continue to be used as add-ons to customize programs and apps, their use in web browsers has decreased somewhat, in favor of using browser extensions instead. Plugins are also all of the little add-ons that optimize the content you put out as an online creator. As the content consumer, they're the extras that allow you to experience the internet in a myriad of ways that include images, sound, videos, and animation. Plugins also help web pages and websites be more than just big blocks of text; there are plugins to help your blog posts rank better, to display YouTube and Vimeo videos on your website, or even help customize your website's fonts. Search engine: A web search engine or Internet search engine is a software system that is designed to carry out web search (Internet search), which means to search the World Wide Web in a systematic way for particular information specified in a textual web search query. The search results are generally presented in a line of results, often referred to as search engine results pages (SERPs). The information may be a mix of links to web pages, images, videos, infographics, articles, research papers, and other types of files. Some search engines also mine data available in databases or open directories. Unlike web directories, which are maintained only by human editors, search engines also maintain real-time information by running an algorithm on a web crawler. Internet content that is not capable of being searched by a web search engine is generally described as the deep web. For users, a search engine is accessed through a browser on their computer, smartphone, tablet, or another device. Today, most new browsers use an omnibox, which is a text box at the top of the browser. The omnibox allows users to type in a URL or a search query. You can also visit one of the major search engines home page to perform a search. Microsoft's Bing search engine is also popular and used by many people. Bing does an excellent job of finding information and answering questions. Yahoo's search engine, while not quite as popular as it used to be, still does an excellent job of searching for information. IT WORKSHOP 2018 BATCH 18 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Filter: A filter may refer to any of the following: 1. The most common filter is a software filter that reads data in and manipulates the data to fit another output pattern or removes data that may not be needed. For example, spam filters help filter unwanted e-mail from reaching your Inbox. 2. Hardware devices can also be filters. For example, a firewall can filter network traffic to help protect a network. 3. Alternatively referred to as censorware, a swear filter, or a content filter, a filter can be used to describe software or hardware which selectively blocks certain data. For example, a parental control Internet filter can be used to help block obscene websites from children on the Internet. Macromedia Flash: Macromedia Flash is a tool that allows powerful animations, interactive features and other complex elements to be embedded in Web pages. Macromedia Flash is a program that creates interactive, and animated media such as motion graphics, videos, presentations and websites. You can control an object’s actions and behaviors using the Behavior panel and the Timeline. For more advanced control you can use Actionscript, Flash's programming language that is very similar to Javascript. While this tutorial was created specifically for Flash 8, you may use it as a reference for Flash MX or MX 2004. IT WORKSHOP 2018 BATCH 19 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING TASK 5 Students would be exposed to the various threats on the internet and would be asked to configure their computer to be safe on the internet. They need to first install antivirus software, configure their personal firewall and windows update on their computer. Then they need to customize their browsers to block pop ups, block active x downloads to avoid viruses and/or worms. Threat: In computer security, a threat is a possible danger that might exploit a vulnerability to breach security and therefore cause possible harm. A threat can be either "intentional" (i.e. hacking: an individual cracker or a criminal organization) or "accidental" (e.g. the possibility of a computer malfunctioning, or the possibility of a natural disaster such as an earthquake, a fire, or a tornado) or otherwise a circumstance, capability, action, or event. Any circumstance or event with the potential to adversely impact organizational operations (including mission, functions, image, or reputation), organizational assets, or individuals through an information system via unauthorized access, destruction, disclosure, modification of information, and/or denial of service. Also, the potential for a threatsource to successfully exploit a particular information system vulnerability. Internet safety: Internet safety or online safety or cyber safety or E-Safety is trying to be safe on the internet and is the knowledge of maximizing the user's personal safety and security risks to private information and property associated with using the internet, and the self-protection from computer crime. As the number of internet users continues to grow worldwide, internets, governments and organizations have expressed concerns about the safety of children using the Internet. Safer Internet Day is celebrated worldwide in February to raise awareness about internet safety. In the UK the Get Safe Online campaign has received sponsorship from government agency Serious Organized Crime Agency (SOCA) and major Internet companies such as Microsoft and eBay. IT WORKSHOP 2018 BATCH 20 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Internet safety or "e safety" has become a fundamental topic in our digital world and includes knowing about one’s Internet privacy and how one’s behaviors can support a healthy interaction with the use of the Internet. Students explore how the Internet offers an amazing way to collaborate with others worldwide, while staying safe through employing strategies such as distinguishing between inappropriate contact and positive connections. These foundational skills and learning more about the Internet safety definition helps students learn how to be safe on the Internet. Antivirus software: Antivirus software helps protect your computer against malware and cybercriminals. Antivirus software looks at data — web pages, files, software, applications — traveling over the network to your devices. It searches for known threats and monitors the behavior of all programs, flagging suspicious behavior. It seeks to block or remove malware as quickly as possible. Antivirus protection is essential, given the array of constantly-emerging cyberthreats. If you don’t have protective software installed, you could be at risk of picking up a virus or being targeted by other malicious software that can remain undetected and wreak havoc on your computer and mobile devices. Several different companies build antivirus software and what each offer can vary but all perform some essential functions: Scan specific files or directories for any malware or known malicious patterns Allow you to schedule scans to automatically run for you Allow you to initiate a scan of a particular file or your entire computer, or of a CD or flash drive at any time. Remove any malicious code detected –sometimes you will be notified of an infection and asked if you want to clean the file, other programs will automatically do this behind the scenes. Show you the ‘health’ of your computer IT WORKSHOP 2018 BATCH 21 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Configure firewall: A firewall exists between your computer and the network. It determines which services on your computer remote users on the network can access. A properly configured firewall can greatly increase the security of your system. Step 1: Secure your firewall. Step 2: Architect your firewall zones and IP addresses. Step 3: Configure access control lists. Step 4: Configure your other firewall services and logging. Step 5: Test your firewall configuration. Windows Update: Windows Update is a free Microsoft service that's used to provide updates like service packs and patches for the Windows operating system and other Microsoft software. Windows Update can also be used to update drivers for popular hardware devices. Patches and other security updates are routinely released through Windows Update on the second Tuesday of every month—it's called Patch Tuesday. However, Microsoft releases updates on other days as well, like for urgent fixes. Windows Update is used to keep Microsoft Windows and several other Microsoft programs updated. Updates often include feature enhancements and security updates to protect Windows from malware and malicious attacks. You can also use Windows Update to access the update history that shows all the updates that have been installed to the computer through the Windows Update service. ActiveX Download: ActiveX Download Control is an object that developers can embed in their own programs. ActiveX Download Control is a free ActiveX control that can programmers can integrate into their own programs. This is not a standalone program. Think of it as an object that contains logic. A programmer can reference that object in code or even drop it onto a IT WORKSHOP 2018 BATCH 22 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Window in a visual manner in order to add the contained logic in their own program. Such an approach is one of the powerful aspects of code reusability. If someone has invented the wheel, there’s no need to reinvent it. The logic that ActiveX Download Control provides is a fullfeatured download manager. Download managers make it simple for users not to just download files but to pause, resume, download faster and more. ActiveX Download Control does all of this. Files are downloaded in segments. Corrupted pieces can be easily replaced, and if a server supports multiple concurrent connections, those additional connections can be used to maximize download speeds. Via the ActiveX Download Control, users can create batches and schedule downloads. During a download, users have access to a range of useful information, such as total size, current speed, average speed, remaining time and so forth. Add new files to the queue while the control works. Pause, resume and cancel at will, and you can even prioritize files in the queue. The ActiveX Download Control is also completely customizable to your particular scenario. If you’ve created a program for accessing resources on your server, for instance, the control can be limited to that scenario. The control also comes with a full-blown user interface. That interface has been designed using standard Windows controls, so it should update and scale accordingly. For custom UIs, you can design your own, and then, link those UI controls to the embedded logic. Virus: A computer virus, much like a flu virus, is designed to spread from host to host and has the ability to replicate itself. Similarly, in the same way that flu viruses cannot reproduce without a host cell, computer viruses cannot reproduce and spread without programming such as a file or document. In more technical terms, a computer virus is a type of malicious code or program written to alter the way a computer operates and is designed to spread from one computer to another. A virus operates by inserting or attaching itself to a legitimate program or document that supports macros in order to execute its code. In the process, a virus has the potential to cause unexpected or damaging effects, such as harming the system software by corrupting or destroying data. IT WORKSHOP 2018 BATCH 23 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Worm: A computer worm is a standalone malware computer program that replicates itself in order to spread to other computers. It often uses a computer network to spread itself, relying on security failures on the target computer to access it. It will use this machine as a host to scan and infect other computers. When these new worm-invaded computers are controlled, the worm will continue to scan and infect other computers using these computers as hosts, and this behavior will continue. Computer worms use recursive method to copy themselves without host program and distribute themselves based on the law of exponential growth, and then controlling and infecting more and more computers in a short time.[3] Worms almost always cause at least some harm to the network, even if only by consuming bandwidth, whereas viruses almost always corrupt or modify files on a targeted computer. Many worms are designed only to spread, and do not attempt to change the systems they pass through. However, as the Morris worm and Mydoom showed, even these "payload-free" worms can cause major disruption by increasing network traffic and other unintended effects. IT WORKSHOP 2018 BATCH 24 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING TASK 6: 1.Using Word to create project certificate. Features to be covered:Formatting Fonts in word, Drop Cap in word, Applying Text effects, Using Character Spacing, Borders and Colors, Inserting Header and Footer, Using Date and Time option in Word. 2.Creating a Newsletter : Features to be covered:- Table of Content, Newspaper columns, Images from files and clip-art, Drawing toolbar and Word Art, Formatting Images, Text boxes, Paragraphs and Mail Merge in word Formatting Font: The graphical user interface (GUI) provides ways to apply the various font formatting options (or character formatting options) to your text. Many of these options are displayed directly in the Font group on the Home tab of the Ribbon and on the contextual toolbar that appears when you right-click within text. Additional options are available in the Font dialog box, which you can open by clicking the Font dialog box launcher (dialog box launcher) in the lower right-hand corner of the Font group on the Home tab. You can also open the Font dialog box without reaching for your mouse by pressing Ctrl+D. The Font dialog box has two tabs. 1.Font 2.Character Spacing The font formatting options that you can configure on the Font tab in the Font dialog box influence the appearance of the individual characters in your text. These font formatting options include the following. Font family (font family) Font style (font style) Font size (8 point, 10 point, 12 point, 16 point, 18 point) Font color (red, orange, green, blue, purple, brown) Underline style (underline style) Underline color (underline color) Strikethrough (strikethrough) Double strikethrough (double strikethrough) IT WORKSHOP 2018 BATCH 25 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Superscript (The mathematical expression x2 contains a superscripted 2.) Subscript (The chemical formula H20 contains a subscripted 2.) Shadow (shadowed) Outline (outlined) Emboss (embossed) Engrave (engraved) Small caps (changes only lowercase letters) (small caps) All caps (all caps) Hidden Additional font formatting options, which mainly influence spatial layout of the characters in your text, can be configured on the Character Spacing tab in the Font dialog box. These formatting settings can be used to do the following. Change the width of characters relative to their height and thereby stretch or contract your text Increase the spacing between characters or decrease it so that characters can even overlap Change the position of your text and create raised characters Change the position of your text and create lowered characters When you change font formatting options without selecting any text, the new settings will be applied to the text that you type after you make the changes. When you select text before changing the font formatting options, the new settings will be applied only to the selected text. For example, a simple way to apply specific font formatting to existing text is to select the text, press Ctrl+D to open the Font dialog box, select the font formatting options that you want to apply to the text, and click OK. If you know the keyboard shortcut or shortcuts (see the table below) for the font formatting that you want to apply, you can press the applicable key or keys to apply the settings to the text that you are about to type or to the text that you have selected. Applying text effects: Add an effect to text Select the text that you want to add an effect to. On the Home tab, in the Font group, click Text Effect. IT WORKSHOP 2018 BATCH 26 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Click the effect that you want. For more choices, point to Outline, Shadow, Reflection, or Glow, and then click the effect that you want to add. Remove an effect from text Select the text that you want to remove an effect from. On the Home tab, in the Font group, click Clear Formatting. clear formatting in the font group Character spacing: Selecting Expanded or Condensed alters the spacing between all selected letters by the same amount. Kerning alters the spacing between particular pairs of letters - in some cases reducing and in other cases expanding the space depending upon the letters. Expand or condense the space evenly between all the selected characters Select the text that you want to change. On the Home tab, click the Font Dialog Box Launcher, and then click the Advanced tab. Font Dialog Box Launcher Note: If you're using Word 2007 the tab is called Character Spacing. In the Spacing box, click Expanded or Condensed, and then specify how much space you want in the By box. Borders and coloring: 1. Start Microsoft Word. Click the “Page Layout” tab at the top of the screen. 2. Click the “Page Borders” button in the middle of the ribbon below the tab. 3. Click the “Box” button on the left of the “Page Border” tab’s window. Click the “Color” drop-down menu and choose a color for the border. This color will apply to any black default borders under the “Style” or “Art” drop-down menus, but you can still get more colorful. 4. Click the “Art” drop-down menu in the middle of the window. Scroll through the options, which include colorful flowers, Aztec-like patterns and holiday themes, all in multi-color shades. IT WORKSHOP 2018 BATCH 27 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING 5. Select one of the borders. Note that even if you chose a color in the “Color” drop-down menu, one of these “Art” borders will override that choice and use the full-color scheme it was created with. 6. Check the “Apply to” menu on the right side of the window. If it does not say “Whole Document,” select that option. 7. Click “OK” to close the window and return to the Word document, now with a new colorful border. Header and footer: The header is a section of the document that appears in the top margin, while the footer is a section of the document that appears in the bottom margin. Headers and footers generally contain additional information such as page numbers, dates, an author's name, and footnotes, which can help keep longer documents organized and make them easier to read. Text entered in the header or footer will appear on each page of the document. Go to Insert > Header or Footer. Choose the header style you want to use. Add a header or footer Tip: Some built-in header and footer designs include page numbers. Add or change text for the header or footer. For more info on things you can do with headers, see Edit your existing headers and footers. Select Close Header and Footer or press Esc to exit. Date and time: Undoubtedly, the time will arise when you need to insert the current date or time in your document. This may be in the introduction of a letter or in a header or footer. Word allows you to quickly insert the date or time in several different formats. This information is inserted as a field which can be updated manually or is updated automatically when you print the document. To insert the date or time into your document, follow these steps: Position the insertion point where you want the date or time inserted. Choose Date and Time from the Insert menu. Word displays the Date and Time dialog box. (See Figure 1.) Select a format for the date or time. IT WORKSHOP 2018 BATCH 28 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Select the check box at the bottom of the dialog box if you want the selected date or time to always reflect whatever is current. If you choose this, it means that Word inserts the date or time as a field so that it always represents the current date or time. Click on OK. The date or time, as specified, is inserted in your document. Table of content: A table of contents, usually headed simply Contents and abbreviated informally as TOC, is a list, usually found on a page before the start of a written work, of its chapter or section titles or brief descriptions with their commencing page numbers. Create a table of contents If you make changes to your document that affect the table of contents, update the table of contents by right-clicking the table of contents and choosing Update Field. To update your table of contents manually, see Update a table of contents. If you have missing entries Missing entries often happen because headings aren't formatted as headings. For each heading that you want in the table of contents, select the heading text. Go to Home > Styles, and then choose Heading Add a heading Update your table of contents. Newspaper columns: To create newspaper-style columns using a table: 1. Open a new document. 2. In Word 2007, from the Insert tab, click Table, and then select Insert Table In other versions of Word, from the Table menu, choose Insert, and then choose Table. 3. In the "Number of columns:" field, type the number of columns you want in your document. For "Number of rows:", type 1 (the number one). 4. Click OK to create your table. At this point your table will probably be small. IT WORKSHOP 2018 BATCH 29 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING You can also add or remove table borders: 1. Move your cursor to the table. In Word 2007, from the Page Layout tab, select Page Borders. In previous versions of Word, from the Format menu, select Borders and Shading. 2. Choose the border options you want for your table. You can choose from presets (such as "None") on the left side of the window, or you can manually select which borders to turn on or off from the "Preview" section on the right. 3. Beneath the "Preview" section, you will see "Apply to:". Make sure this option is set to Table if you want your border selection to apply to the entire table. 4. If you see gray lines where you have chosen not to have a border, don't worry. These are non-printing gridlines meant to help you see where your columns are. To turn gridlines on and off: Word 2007: From the Layout tab, select View Gridlines . o Previous versions of Word for Windows: From the Table menu, choose Hide Gridlines or Show Gridlines . o Images from files and clipart: Images are a great way to liven up a document, and Word offers a few methods to insert them. There are built-in clip art images for just about every topic, so you may be able to find a perfect clip art image for your document. If you have a more specific image in mind, you can insert a picture from a file. Inserting clip art and pictures Adding clip art and pictures to your document can be a great way to illustrate important information or add decorative accents to existing text. You can insert images from your computer or search Microsoft's extensive selection of clip art to find the image you need. Once an image has been inserted, you can format text to wrap around the image. To locate clip art: Select the Insert tab. IT WORKSHOP 2018 BATCH 30 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Click the Clip Art command in the Illustrations group. The Clip Art command The clip art options appear in the task pane to the right of the document. Enter keywords in the Search for: field that are related to the image you want to insert. Click the drop-down arrow in the Results should be: field. Deselect any types of media you do not want to see. Choosing which media types to display If you also want to search for clip art on Office.com, place a check mark next to Include Office.com content. Otherwise, it will just search for clip art on your computer. Including Office.com content Click Go. To insert clip art: Review the results from a clip art search. Place your insertion point in the document where you want to insert the clip art. Click an image in the Clip Art pane. It will appear in the document. Selecting a Clip Art image You can also click the drop-down arrow next to the image in the Clip Art pane to view more options. To insert a picture from a file: Place your insertion point where you want the image to appear. Select the Insert tab. Click the Picture command in the Illustrations group. The Insert Picture dialog box appears. Inserting a picture from a file Select the desired image file, then click Insert to add it to your document. Selecting an image file To resize an image, click and drag one of the corner sizing handles. The image will change size while keeping the same proportions. If you want to stretch it horizontally or vertically, you can use the side sizing handles. IT WORKSHOP 2018 BATCH 31 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Drawing toolbar: These are the basic types of graphics that you can use to enhance your Word documents: drawing objects, SmartArt, charts, pictures, and clip art. Drawings refer to a drawing object or a group of drawing objects. Drawing objects include shapes, diagrams, flowcharts, curves, lines, and WordArt. These objects are part of your Word document. You can change and enhance these objects with colors, patterns, borders, and other effects. Add a drawing to a document Click in your document where you want to create the drawing. On the Insert tab, in the Illustrations group, click Shapes. Illustrations group on the Insert tab in Excel You can do any of the following on the Format tab, which appears after you insert a drawing shape: Insert a shape. On the Format tab, in the Insert Shapes group, click a shape, and then click somewhere in the document. Change a shape. Click the shape you want to change. On the Format tab, in the Insert Shapes group, click Edit Shape, point to Change Shape, and then choose a different shape. Add text to a shape. Click the shape you where you want text, and then type. Group selected shapes. Select several shapes at a time by pressing CTRL on your keyboard and clicking each shape you want to include in the group. On the Format tab in the Arrange group, click Group so that all of the shapes will be treated like a single object. Draw in the document. On the Format tab, in the Insert Shapes group, expand the shapes options by clicking the arrow. Under Lines click Freeform or Scribble. Adjust the size of the shapes. Select the shape or shapes you want to resize. On the Format tab, in the Size group, click the arrows or type new dimensions in the Height and Width boxes. Apply a style to a shape. In the Shape Styles group, rest your pointer over a style to see what your shape will look like when you apply that style. Click the style to apply it. Or, click Shape Fill or Shape Outline and select the options that you want. Shape Styles commands on the ribbon. Add flow charts with connectors. Before you create a flow chart, add a drawing canvas by clicking the Insert tab, clicking Shapes in IT WORKSHOP 2018 BATCH 32 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING the Illustrations group, and then clicking New Drawing Canvas. On the Format tab, in the Insert Shapes group, click a Flow chart shape. Under Lines, choose a connector line such as the Curved Arrow Connector. Use shadow and three-dimensional (3-D) effects to add interest to the shapes in your drawing. On the Format tab, in the Shape Styles group, click Shape Effects, and choose an effect. Align the objects on the canvas. To align the objects, press and hold CTRL while you select the objects that you want to align. On the Format tab, in the Arrange group, click Align to choose from an assortment of alignment commands. Delete all or part of a drawing 1. 2. 3. 4. Select the drawing object that you want to delete. Press DELETE. Word Art: On the Drawing toolbar, click Insert WordArt. Click the WordArt effect you want, and then click OK. In the Edit WordArt Text dialog box, type the text you want. Do any of the following: To change the font type, in the Font list, select a font. To change the font size, in the Size list, select a size. To make text bold, click the Bold button. To make text italic, click the Italic button. Formatting images: Formatting of the images can be achieved by selecting the image and double click on the picture, format picture dialog box appears. The same can be achieved by selecting the tools menu > customize>tool bars tab>picture and click close. Basic formatting features of an image Resize a drawing: Select the drawing canvas On the Drawing Canvas toolbar, do one of the following: To make the drawing canvas boundary larger without changing the size of the objects on the canvas, click Expand . To make the drawing canvas boundary fit tightly around the drawing objects or pictures, click Fit . IT WORKSHOP 2018 BATCH 33 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING To scale the drawing and make the objects and canvas proportionately smaller or larger, click Scale Drawing, and then drag the edges of the canvas. Resize a picture or shape: Position the mouse pointer over one of the sizing handles Drag the sizing handle until the object is the shape and size you want. To increase or decrease the size in one or more directions, drag the mouse away from or toward the center, while doing one of the following: To keep the center of an object in the same place, hold down CTRL while dragging the mouse. To maintain the object's proportions, drag one of the corner sizing handles. To maintain the proportions while keeping the center in the same place, hold down CTRL while dragging one of the corner sizing handles. Crop a picture: Select the picture you want to crop. On the Picture toolbar, click Crop. Position the cropping tool over a cropping handle and then do one of the following: To crop one side, drag the center handle on that side inward. To crop equally on two sides at once, hold down CTRL as you drag the center handle on either side inward. To crop equally on all four sides at once, hold down CTRL as you drag a corner handle inward. On the Picture toolbar, click Crop to turn off the Crop command. Text boxes: On the Drawing toolbar, click Text Box . Click or drag in your document where you want to insert the text box You can use the options on the Drawing toolbar to enhance a text box— for example, to change the fill color— just as you can with any other drawing object Paragraphs: Change line spacing: IT WORKSHOP 2018 BATCH 34 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Select the text you want to change. On the Formatting toolbar, point to Line Spacing, and then do one of the following: To apply a new setting, click the arrow, and then select the number that you want. To apply the most recently used setting, click the button. To set more precise measurements, click the arrow, click More, and then select the options you want under Line Spacing. Change spacing before or after paragraphs: Select the paragraphs in which you want to change spacing. On the Format menu, click Paragraph, and then click the Indents and Spacing tab. Under Spacing, enter the spacing you want in the Before or After box. Change paragraph direction: Place the insertion point in the paragraph that you want to change, or select several paragraphs. Do one of the following: To have text begin from the left, click Left-to-Right on the Formatting toolbar. To have text begin from the right, click Right-to-Left on the Formatting toolbar. When you change the paragraph direction, Microsoft Word leaves justified and centered text as it is. In the case of left-aligned or right-aligned text, Word flips the alignment to its opposite. For example, if you have a left-to-right paragraph that is right aligned, such as the date at the top of a letter, clicking Right-to-Left results in a right-to-left paragraph that is left aligned. Mailmerge: Mail merge consists in combining mail and letters and pre-addressed envelopes or mailing labels for mass mailings from a form letter. Microsoft Word can insert content from a database, spreadsheet, or table into Word documents. 1. In a blank Microsoft Word document, click on the Mailings tab, and in the Start Mail Merge group, click Start Mail Merge . 2. Click Step-by-Step Mail Merge Wizard . 3. Select your document type. IT WORKSHOP 2018 BATCH 35 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING 4. Select the starting document. 5. Select recipients. 6. Write the letter and add custom fields. IT WORKSHOP 2018 BATCH 36 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING TASK 7 Using excel creating a Scheduler and Calculating GPA– Features to be covered:Grid lines, Format Cells, Summation, auto fill, Formatting Text, Cell Referencing, Formulae in excel – average, std. deviation, Charts, Renaming and Inserting worksheets, Hyper linking, Count function, LOOKUP/VLOOKUP, Sorting, Conditional formatting. Gridlines: Gridlines in Excel are the horizontal and vertical gray lines that differentiate between cells in a worksheet. The gridlines guide users to differentiate between the specific cells and read the data in an organized manner. They also help users navigate through the worksheet columns and rows with ease. If the gridlines on your worksheet are hidden, you can follow these steps to show them again. Select one or more worksheets. On the View tab, in the Show group, select the Gridlines check box. To show gridlines: Navigate to the “View” tab on the Excel ribbon. Under it search for the Gridlines option in 'Show' section. When found, uncheck the “Gridlines” option and the gridlines will be hidden, instantly. Alternatively, you can choose to hide the grid lines from “Page layout” and uncheck the Gridlines “View” option. Format Cells: All cell content uses the same formatting by default, which can make it difficult to read a workbook with a lot of information. Basic formatting can customize the look and feel of your workbook, allowing you to draw attention to specific sections and making your content easier to view and understand. You can also apply number formatting to tell Excel exactly what type of data you’re using in the workbook, such as percentages (%), currency ($), and so on. IT WORKSHOP 2018 BATCH 37 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING To formatting the cells there are five tabs in Format Cells. By using this, we can change the date style, time style, Alignments, insert the border with different style, protect the cells, etc. Number Tab:-Excel number format used for changing the formatting of number cells in decimals, providing the desired format, in terms of number, dates, converting into percentage, fractions, etc. Alignment Tab:-By using this tab, we can align the cell’s text, merge the two cell’s text with each other. If the text is hidden, then by using the wrap text, we can show it properly, and also we can align the text as per the desired direction. Font Tab: -By using this tab, we can change the font, font color, font style, font size, etc. We can underline the text, can change the font effects, and we can preview also how it would look like. Border Tab: -By using this tab, we can create colorful border line to different type of styles; if we don’t want to provide the border outline, we can leave it blank Fill Tab: -By using this tab, we can fill the cell or range with colors in different types of styles, we can combine two colors, and also we can insert picture in a cell by using Fill option. Protection Tab: -By using this tab, we can protect cell, range, formula containing cells, sheet, etc. Summation: If you need to sum a column or row of numbers, let Excel do the math for you. Select a cell next to the numbers you want to sum, click AutoSum on the Home tab, press Enter, and you're done. When you click AutoSum, Excel automatically enters a formula (that uses the SUM function) to sum the numbers. 1. Select a cell next to the numbers you want to sum: To sum a column, select the cell immediately below the last value in the column. 2. Click the AutoSum button on either the Home or Formulas tab. 3. Press the Enter key to complete the formula. IT WORKSHOP 2018 BATCH 38 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Autofill: Use the Auto Fill feature to fill cells with data that follows a pattern or are based on data in other cells. Select one or more cells you want to use as a basis for filling additional cells. For a series like 1, 2, 3, 4, 5..., type 1 and 2 in the first two cells. For the series 2, 4, 6, 8..., type 2 and 4. For the series 2, 2, 2, 2..., type 2 in first cell only. Drag the fill handle Fill handle . If needed, click Auto Fill Options Button image and choose the option you want. Formatting text: 1. Launch Excel. Open the Excel worksheet you want to format. 2. Click the "Home" tab. 3. Click inside the cell you want to format. 4. Click the font drop-down list box on the "Home" ribbon. Click on the font style you want to use. 5. Click on the font size drop-down list box and click on a larger or smaller font size. 6. Click on the "A" icon to the right of the paint bucket icon to change the text color. Cell referencing: A cell reference in Excel refers to the value of a different cell or cell range on the current worksheet or a different worksheet within the spreadsheet. A cell reference can be used as a variable in a formula. A cell reference refers to a cell or a range of cells on a worksheet and can be used in a formula so that Microsoft Office Excel can find the values or data that you want that formula to calculate.In one or several formulas, you can use a cell reference to refer to: Data from one or more contiguous cells on the worksheet. Data contained in different areas of a worksheet. Data on other worksheets in the same workbook. Charts: On the chart menu click chart type Text direction. IT WORKSHOP 2018 BATCH 39 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Click the arrow down next to the text direction button. For right to left click right to left. For left to right reading order, click left to right. For reading order that is consistent with the language of the first entered character, click context. For reading order that is inconsistent with the language of the first entered character, click control. In the tools menu click options and then click chart tab. To show all worksheet data in the chart even if some rows and columns are hidden, clear the plot visible cells by check box. To prevent hidden rows and columns from displaying in the chart, select the plot cells only check box. Hyperlinking: Create a worksheet: On the file menu, click new, and then click blank workbook task pane. Insert a worksheet: C lick worksheet on the insert menu. Right click on sheet tab and then click insert double click the template for the type of sheet you want. Hyperlink: Using hyperlink we can insert one more sheet in the present sheet To use the Insert Hyperlink command, follow these steps to get started: Select the cell where you want the hyperlink On the Excel Ribbon, click the Insert tab, and click the Hyperlink command o OR, right-click the cell, and click Link o OR, use the keyboard shortcut - Ctrl + K Count function: The Excel COUNT function returns the count of values that are numbers, generally cells that contain numbers. Values can be supplied as constants, cell references, or ranges. Purpose :Count numbers Return value :Count of numeric values Syntax :=COUNT (value1, [value2], ...) Arguments: value1 - An item, cell reference, or range. IT WORKSHOP 2018 BATCH 40 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING value2 - [optional] An item, cell reference, or range. Usage: The COUNT function returns the count of numeric values in the list of supplied arguments. Arguments can be individual items, cell references, or ranges up to a total of 255 arguments. All numbers including negative values, percentages, dates, fractions, and time are counted. Empty cells and text values are ignored. Sort: 1. 2. 3. 4. 5. 6. Select the cell range you want to sort. Select the Data tab on the Ribbon, then click the Sort command. The Sort dialog box will appear. Decide the sorting order (either ascending or descending). Once you're satisfied with your selection, click OK. The cell range will be sorted by the selected column. Formulae in Excel: First click on start button at the bottom of the screen on status bar. Click on programs and then on Microsoft excel. Then open a new document. Give the main heading and subheading by changing the size so that they look in block letters. Enter the data. To calculate go to Insert menu in the menu bar and then click on function and then ok. Then select the data to which you want to calculate mean. Then you get the required answer. In same way, sample means standard deviation lower count limit and upper count limit. Go to insert menu and click on function and select the required operation to be done and select the data and calculate. Formulas for all the above are given below. Mean = (s1 + s2 + s3 + s4 + s5)/5; Sample mean = avg (mean) Standard deviation = (mean, sample, mean) Sample standard deviation= avg (Standard deviation) Lower count limit = sample mean – sample standard deviation. Upper count limit = Sample mean + Sample Standard deviation Insert a worksheet: Select the Select plus icon at the bottom of the screen. Or, select Home > Insert > Insert Sheet. IT WORKSHOP 2018 BATCH 41 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Rename a worksheet: Double-click the sheet name on the Sheet tab to quickly rename it. Or, right-click on the Sheet tab, click Rename, and type a new name. Lookup: Description: The Microsoft Excel LOOKUP function returns a value from a range (one row or one column) or from an array. The LOOKUP function is a built-in function in Excel that is categorized as a Lookup/Reference Function. It can be used as a worksheet function (WS) in Excel. As a worksheet function, the LOOKUP function can be entered as part of a formula in a cell of a worksheet. There are 2 different syntaxes for the LOOKUP function: LOOKUP Function (Syntax #1): In Syntax #1, the LOOKUP function searches for value in the lookup_range and returns the value in the result_range that is in the same position. The syntax for the LOOKUP function in Microsoft Excel is: LOOKUP( value, lookup_range, [result_range] ) Parameters or Arguments: value The value to search for in the lookup_range. lookup_range A single row or single column of data that is sorted in ascending order. The LOOKUP function searches for value in this range. result_range Optional. It is a single row or single column of data that is the same size as the lookup_range. The LOOKUP function searches for the value in the lookup_range and returns the value from the same position in the result_range. If this parameter is omitted, it will return the first column of data. Returns: IT WORKSHOP 2018 BATCH 42 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING The LOOKUP function returns any datatype such as a string, numeric, date, etc. If the LOOKUP function can not find an exact match, it chooses the largest value in the lookup_range that is less than or equal to the value. If the value is smaller than all of the values in the lookup_range, then the LOOKUP function will return #N/A. If the values in the LOOKUP_range are not sorted in ascending order, the LOOKUP function will return the incorrect value. LOOKUP Function (Syntax #2): In Syntax #2, the LOOKUP function searches for the value in the first row or column of the array and returns the corresponding value in the last row or column of the array. The syntax for the LOOKUP function in Microsoft Excel is: LOOKUP( value, array ) Parameters or Arguments: value The value to search for in the array. The values must be in ascending order. array An array of values that contains both the values to search for and return. Returns: The LOOKUP function returns any datatype such as a string, numeric, date, etc. If the LOOKUP function can not find an exact match, it chooses the largest value in the lookup_range that is less than or equal to the value. If the value is smaller than all of the values in the lookup_range, then the LOOKUP function will return #N/A. If the values in the array are not sorted in ascending order, the LOOKUP function will return the incorrect value. Vlookup: Summary : IT WORKSHOP 2018 BATCH 43 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING VLOOKUP is an Excel function to lookup and retrieve data from a specific column in table. VLOOKUP supports approximate and exact matching, and wildcards (* ?) for partial matches. The "V" stands for "vertical". Lookup values must appear in the first column of the table, with lookup columns to the right. Purpose : Lookup a value in a table by matching on the first column Return value : The matched value from a table. Syntax : =VLOOKUP (value, table, col_index, [range_lookup]) Arguments : value - The value to look for in the first column of a table. table - The table from which to retrieve a value. col_index - The column in the table from which to retrieve a value. range_lookup - [optional] TRUE = approximate match (default). FALSE = exact match. Conditional formatting: Conditional formatting in Excel enables you to highlight cells with a certain color, depending on the cell's value. Highlight Cells Rules: To highlight cells that are greater than a value, execute the following steps. 1. Select the range A1:A10. 2. On the Home tab, in the Styles group, click Conditional Formatting. 3. Click Highlight Cells Rules, Greater Than. 4. Enter the value 80 and select a formatting style. 5. Click OK. 6. Change the value of cell A1 to 81. Result. Excel changes the format of cell A1 automatically. IT WORKSHOP 2018 BATCH 44 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Clear Rules: To clear a conditional formatting rule, execute the following steps. 1. Select the range A1:A10. Select Cells 2. On the Home tab, in the Styles group, click Conditional Formatting. Click Conditional Formatting 3. Click Clear Rules, Clear Rules from Selected Cells. IT WORKSHOP 2018 BATCH 45 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING IT WORKSHOP 2018 BATCH 46 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING TASK 8: Students will be working on basic power point utilities and tools which help them create basic power point presentation. Topic covered during this week includes :- PPT Orientation, Slide Layouts, Inserting Text, Word Art, Formatting Text, Bullets and Numbering, Auto Shapes, Hyperlinks, Inserting –Images, Clip Art, Audio, Video, Objects, Tables and Charts, Lines and Arrows , Master Layouts (slide, template, and notes), Types of views (basic, presentation, slide slotter, notes etc), Inserting – Background, textures, Design Templates, Hidden slides in and Power point. Students will be given model power point presentation which needs to be replicated. PPT Orientation: PowerPoint slides are automatically set up in landscape (horizontal) layout Landscape slide orientation , but you can change the slide orientation to portrait (vertical) layout Portrait slide orientation Select the Design tab on the toolbar ribbon. The Slide Size menu button towards the right end has the slide orientation control. Near the right end, select Slide Size, and then click Custom Slide Size. In the Slide Size dialog box, select Portrait, then select OK. In the next dialog box, you can select Maximize to take full advantage of the space available, or you can select Ensure Fit to make sure that your content fits on the vertical page. Slide Layouts: On the format menu, click slide layout. On the slides tab in normal view, select the slides; you want to apply a layout too. In the slide layout task pane, point to layout you and then click it. A new slide can also be inserted within the task pane. Point the layout you want the slide to have, click the arrow and then click the insert new slide. Inserting Text: Text can be added to layout. Align text in the top, middle or bottom of a cell. IT WORKSHOP 2018 BATCH 47 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Align text on the right or left, or in the center of a cell. Change cell margins. Insert a tab in a table. To make the symbol command available, in normal view, place the insertion point on the outbox tab or in a text place holders on the slide. On the insert menu, click symbol. To change fonts, click a name in the font box. Word Art: Microsoft PowerPoint had a wider variety of tools which allows us to enhance our presentations, one of the most used tools are the WordArt. WordArt is a special feature that allows the users to give special effects to the text such as curved text, 3D text, color gradiants, and more. To insert a WordArt you just need to click at Insert > WordArt. Now you will be browsing the WordArt gallery, in which you can see a wider variety of designs. You can always modify the text, get it bold or italic, change the size, etc. Bullets and numbering: Select the lines of text that you want to add bullets or numbering to. Click bullets or numbering. Autoshapes: Select the auto shape that has the text you want to position. Double-click the selection rectangle of the auto shape or text box and then click the text box tab in the format dialog box. In the text anchor point box, click the position you want the text to start in. Hyperlink: Select the text or object that you want to represent the hyperlink. Click insert hyperlink. Under link to, click place in this document. IT WORKSHOP 2018 BATCH 48 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Insert images: Click where you want to insert the picture. On the drawing tool bar, click insert picture. Locate the folder that contains the picture that you want to insert, and then click the picture file. Clipart: Clip Art is a collection of media files (images, videos, audio, and animation files) that Microsoft includes with the PowerPoint application. If your computer has an Internet connection, then you can also access Bing.com to search for images. To insert clip art on a PowerPoint slide, follow the steps below. Click in the slide where you want to insert a clip art file. On the Insert tab, in the Images group, click Online Pictures. (In PowerPoint 2007/2010, this option is called Clip Art.) In the Insert Pictures dialog box (Clip Art task pane in PowerPoint 2007/2010), enter your search terms in the Bing.com field and press Enter. Your search results load in the task pane. Locate the clip art you want to insert in your slide and double-click on it or click the item and select Insert. Audio and video: 1. To insert a sound or video, go to the Insert Ribbon and click on the Video or Audio icon and choose Video or Audio from File. 2. Navigate to the correct clip, and click the OK button. 3. Once audio is inserted, an audio button will appear, allowing sound to play when it is clicked on. Tables and charts: Tables: On the standard tool bar, click insert table. Print to select the numbers of rows and columns you want and then click. Charts: Click the slide where you want to place the embedded object. IT WORKSHOP 2018 BATCH 49 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING On the insert menu, click chart. Click a cell on the data sheet and then type the information you want. To return to the slide, click outside the chart. Lines and arrows: In Microsoft power point, double click the chart. Double click the chart item you want to change. On the patterns tab, do one or both of the following. To change the colors, patterns or lines, select the options you want. To specify a fill effect, click fill effect and then select the options you want on the gradient, text patterns or picture tabs. Master layout: A slide master is the top slide in a hierarchy of slides that stores information about the theme and slide layouts of a presentation, including the background, color, fonts, effects, placeholder sizes, and positioning. To create a master slide: On the View tab, click Slide Master. In Slide Master View, the slide master appears at the top of the thumbnail pane with related layouts beneath it. Click to select the master slide, then click Master Layout on the Slide Master tab. Make the updates that you want. To remove any built-in slide layouts that accompany the default slide master, in the slide thumbnail pane, right-click each slide layout that you want to delete, then click Delete Layout. To set the page orientation for all of the slides in your presentation, on the Slide Master tab, click Slide Orientation, then click either Portrait or Landscape. On the File tab, click Save As. In the File name box, type a file name. In the Save as type list, click PowerPoint Template, then click Save. Types of view: IT WORKSHOP 2018 BATCH 50 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING The views in PowerPoint that you can use to edit, print, and deliver your presentation are as follows: Normal view. Slide Sorter view. Notes Page view. Outline view (Available in PowerPoint 2016 for Mac and newer versions) Slide Show view. Presenter view. Master views: Slide, Handout, and Notes. Inserting background: Select the slide you want to add a background picture to. Select Design > Format Background. In the Format Background pane, select Picture or texture fill. Select File. In the Insert Picture dialog box, choose the picture you want to use and then select Insert. Textures: In the Format Background pane, click Picture or texture fill. Click the Texture button to display the texture gallery. You can select from a variety of textures, including fabric, marble, granite, wood grain, and Formica-like textures in various colors. In the texture gallery, click the texture you want to apply. Move the Transparency slider to adjust the background color transparency, or set a specific transparency percentage. Design Templates: PowerPoint offers design templates to make it easy to create an attractive presentation. These templates come in a variety of colors and styles. You can apply a design to existing slides or begin a new presentation with a template. To begin a new presentation with a design template: Open PowerPoint. In the task pane under New, click From Design Template. Choose Design Template A list of templates appears. IT WORKSHOP 2018 BATCH 51 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Move your mouse pointer through the different designs or use the scroll bar. Click the down-pointing arrow in the gray box next to the template you like. Choose Apply to All Slides. Hidden slides: To hide a slide, right-click the slide that you want to hide, and then click Hide Slide. To show a slide that you previously hid, right-click the slide that you want to show, and then click Hide Slide. IT WORKSHOP 2018 BATCH 52 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING TASK 9 Practicing MATLAB environment with simple exercises to familiarize Command Window, History, Workspace, Current Directory, Figure window, Edit window, Shortcuts, Help files Command Window: The Command Window is one of the main tools you use to enter data, run MATLAB functions and other M-files, and display results. If you are viewing this document in the Help browser, you can watch the Desktop and Command Window video demo for an overview of the major functionality. When the Command Window is not open, access it by selecting Command Window from the Desktop menu. Alternatively, open the Command Window with the commandwindow function. If you prefer a simple command line interface without the other MATLAB desktop tools, select Desktop -> Desktop Layout -> Command Window Only. For more information, see Arranging the Desktop--Overview. The Command Window prompt, >>, is where you enter statements. For example, you can enter a MATLAB function with arguments, or assign values to variables. The prompt indicates that MATLAB is ready to accept input from you. When you see the prompt, you can enter a variable or run a statement. This prompt is also known as the command line. Image of empty MATLAB Command Window When MATLAB displays the K>> prompt in the Command Window, MATLAB is in debug mode. Type dbquit to return to normal mode. Choose Apply to All Slides. History: The Command History window displays a log of statements that you ran in the current and previous MATLAB sessions. The Command History lists the time and date of each session in the short date format for your operating system, followed by the statements from that session. Brackets in the left margin indicate statements that were processed as a group. A colored mark precedes each statement that generated an error. IT WORKSHOP 2018 BATCH 53 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING MATLAB saves statements that run in the Command Window to the history file History.xml. These statements include those you run using the Evaluate Selection item on context menus in tools such as the Editor, Command History window, and Help browser. By default, MATLAB automatically saves the command history file after each statement. The history file does not include every action taken in MATLAB. For example, changes to values in the Variables editor are not included in the Command History window. All entries remain until you delete them, or until the number of statements in the history file exceeds the number of statements to save, as specified in the Command History preferences. When the specified limit is reached, MATLAB automatically deletes the oldest entries. By default, the Command History window saves 25,000 statements. Workspace: The Workspace browser enables you to view and interactively manage the contents of the workspace in MATLAB. For each variable or object in the workspace, the Workspace browser also can display statistics, when relevant, such as the minimum, maximum, and mean. You can edit the contents of scalar (1-by-1) variables directly in the Workspace browser. Right-click the variable and select Edit Value. To edit other variables, double-click the variable name in the Workspace browser to open it in the Variables editor. Open the Workspace Browser: To open the Workspace browser if it is not currently visible, do one of the following: MATLAB Toolstrip: On the Home tab, in the Environment section, click Layout. Then, in the Show section, select Workspace. MATLAB command prompt: Enter workspace. Current Directory: The Current Folder browser enables you to interactively manage files and folders in MATLAB®. Use the Current Folder browser to view, create, open, move, and rename files and folders in the current folder. Open the Current Folder Browser: To open the Current Folder browser if it is not currently visible, do one of the following: IT WORKSHOP 2018 BATCH 54 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING MATLAB Toolstrip: On the Home tab, in the Environment section, click Layout. Then, in the Show section, select Current Folder. MATLAB command prompt: Enter filebrowser. Figure window: Create figure window Syntax: figure figure(Name,Value) f = figure(___) figure(f) figure(n) Description: figure creates a new figure window using default property values. The resulting figure is the current figure. figure(Name,Value) modifies properties of the figure using one or more name-value pair arguments. For example, figure('Color','white') sets the background color to white. f = figure(___) returns the Figure object. Use f to query or modify properties of the figure after it is created. figure(f) makes the figure specified by f the current figure and displays it on top of all other figures. figure(n) finds a figure in which the Number property is equal to n, and makes it the current figure. If no figure exists with that property value, MATLAB® creates a new figure and sets its Number property to n. Edit window: Edit or create file Syntax: edit edit file IT WORKSHOP 2018 BATCH 55 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING edit file1 ... fileN Description: edit opens a new file called Untitled.m in the Editor. MATLAB does not automatically save Untitled.m. edit file opens the specified file in the Editor. If file does not already exist, MATLAB asks if you want to create it. file can include a partial path, complete path, relative path, or no path. If file includes a partial path or no path, edit will look for the file on the search path. You must have write permission to the path to create file. Otherwise, MATLAB ignores the argument. You must specify the extension to open .mat and .mdl files. MATLAB cannot directly edit binary files, such as .p and .mex files. edit file1 ... fileN opens each file, file1 ... fileN, in the Editor. Shortcuts: Command Window: Ctrl+0 Command History: Ctrl+1 Current Folder: Ctrl+2 Workspace: Ctrl+3 Profiler: Ctrl+4 Figure Palette: Ctrl+6 Plot Browser: Ctrl+7 Property Editor: Ctrl+8 Editor: Ctrl+Shift+0 Figures: Ctrl+Shift+1 Web browser: Ctrl+Shift+2 Variables Editor: Ctrl+Shift+3 Comparison Tool: Ctrl+Shift+4 Help browser: Ctrl+Shift+5 IT WORKSHOP 2018 BATCH 56 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Help files: You can create HTML help files in any text editor or web publishing software. To create help files in MATLAB, use either of these two methods: Create a live script (*.mlx) and export it to HTML. For more information, see Share Live Scripts and Functions. Create a script (*.m), and publish it to HTML. For more information, see Publish and Share MATLAB Code. Store all your HTML help files in one folder, such as an html subfolder in your toolbox folder. This folder must be: On the MATLAB search path Outside the matlabroot folder Outside any installed hardware support package help folder To create the help for an entire project (including all subdirectories) simply execute: wg_publish_all To generate a corresponding index (contents) page try create_index_html. In case you like a certain words always highlighted or as headings you can easily add them within wg_publish. - help/documentation in html, latex, doc, ... - executes Matlab examples and includes them in the help - includes graphics - integrates simple formulas - creates html index - cross-referencing etc. IT WORKSHOP 2018 BATCH 57 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING TASK 10 Data types, Constants and Variables, Character constants, operators, Assignment statements, Control Structures: For loops, While, If control structures, Switch, Break, Continue statements. Datatypes: MATLAB provides various functions for identifying data type of a variable. Function Purpose is Detect state isa Determine if input is object of specified class iscell Determine whether input is cell array iscellstr Determine whether input is cell array of strings ischar Determine whether item is character array isfield Determine whether input is structure array field isfloat Determine if input is floating-point array ishghandle True for Handle Graphics object handles isinteger Determine if input is integer array isjava Determine if input is Java object islogical Determine if input is logical array isnumeric Determine if input is numeric array isobject Determine if input is MATLAB object isreal Check if input is real array isscalar Determine whether input is scalar isstr Determine whether input is character array isstruct Determine whether input is structure array isvector Determine whether input is vector class Determine class of object IT WORKSHOP 2018 BATCH 58 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING validateattributes Check validity of array whos List variables in workspace, with sizes and types Constants and Variables: In MATLAB environment, every variable is an array or matrix. You can assign variables in a simple way. For example, x=3 % defining x and initializing it with a value MATLAB will execute the above statement and return the following result − x=3 It creates a 1-by-1 matrix named x and stores the value 3 in its element. Let us check another example, x = sqrt(16) % defining x and initializing it with an expression MATLAB will execute the above statement and return the following result − x=4 Please note that − Once a variable is entered into the system, you can refer to it later. Variables must have values before they are used. When an expression returns a result that is not assigned to any variable, the system assigns it to a variable named ans, which can be used later. For example, sqrt(78) MATLAB will execute the above statement and return the following result − ans = 8.8318 You can use this variable ans − sqrt(78); IT WORKSHOP 2018 BATCH 59 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING 9876/ans MATLAB will execute the above statement and return the following result − ans = 1118.2 Let's look at another example − x = 7 * 8; y = x * 7.89 MATLAB will execute the above statement and return the following result − y = 441.84 Multiple Assignments: You can have multiple assignments on the same line. For example, a = 2; b = 7; c = a * b MATLAB will execute the above statement and return the following result − c = 14 I have forgotten the Variables! The who command displays all the variable names you have used. who MATLAB will execute the above statement and return the following result − Your variables are: a ans b c The whos command displays little more about the variables − Variables currently in memory Type of each variables Memory allocated to each variable IT WORKSHOP 2018 BATCH 60 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Whether they are complex variables or not whos MATLAB will execute the above statement and return the following result − Attr Name Size ==== ==== a ==== 1x1 ans Bytes 1x70 Class ==== 8 757 ===== double cell b 1x1 8 double c 1x1 8 double Total is 73 elements using 781 bytes The clear command deletes all (or the specified) variable(s) from the memory. clear x % it will delete x, won't display anything clear % it will delete all variables in the workspace % peacefully and unobtrusively Long Assignments: Long assignments can be extended to another line by using an ellipses (...). For example, initial_velocity = 0; acceleration = 9.8; time = 20; final_velocity = initial_velocity + acceleration * time MATLAB will execute the above statement and return the following result − final_velocity = 196 IT WORKSHOP 2018 BATCH 61 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING The format Command By default, MATLAB displays numbers with four decimal place values. This is known as short format. However, if you want more precision, you need to use the format command. The format long command displays 16 digits after decimal. For example − format long x = 7 + 10/3 + 5 ^ 1.2 MATLAB will execute the above statement and return the following result− x = 17.2319816406394 Another example, format short x = 7 + 10/3 + 5 ^ 1.2 MATLAB will execute the above statement and return the following result − x = 17.232 The format bank command rounds numbers to two decimal places. For example, format bank daily_wage = 177.45; weekly_wage = daily_wage * 6 MATLAB will execute the above statement and return the following result − weekly_wage = 1064.70 MATLAB displays large numbers using exponential notation. IT WORKSHOP 2018 BATCH 62 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING The format short e command allows displaying in exponential form with four decimal places plus the exponent. For example, format short e 4.678 * 4.9 MATLAB will execute the above statement and return the following result − ans = 2.2922e+01 The format long e command allows displaying in exponential form with four decimal places plus the exponent. For example, format long e x = pi MATLAB will execute the above statement and return the following result − x = 3.141592653589793e+00 The format rat command gives the closest rational expression resulting from a calculation. For example, format rat 4.678 * 4.9 MATLAB will execute the above statement and return the following result − ans = 34177/1491 Creating Vectors: A vector is a one-dimensional array of numbers. MATLAB allows creating two types of vectors − Row vectors Column vectors IT WORKSHOP 2018 BATCH 63 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Row vectors are created by enclosing the set of elements in square brackets, using space or comma to delimit the elements. For example, r = [7 8 9 10 11] MATLAB will execute the above statement and return the following result − r= 7 8 9 10 11 Another example, r = [7 8 9 10 11]; t = [2, 3, 4, 5, 6]; res = r + t MATLAB will execute the above statement and return the following result − res = 9 11 13 15 17 Column vectors are created by enclosing the set of elements in square brackets, using semicolon(;) to delimit the elements. c = [7; 8; 9; 10; 11] MATLAB will execute the above statement and return the following result − c= 7 8 9 IT WORKSHOP 2018 BATCH 64 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING 10 11 Creating Matrices: A matrix is a two-dimensional array of numbers. In MATLAB, a matrix is created by entering each row as a sequence of space or comma separated elements, and end of a row is demarcated by a semicolon. For example, let us create a 3-by-3 matrix as − m = [1 2 3; 4 5 6; 7 8 9] MATLAB will execute the above statement and return the following result − m= 1 2 3 4 5 6 7 8 9 MATLAB supports the following special variables and constants − Name Meaning ans Most recent answer. eps Accuracy of floating-point precision. i,j The imaginary unit √-1. Inf Infinity. NaN Undefined numerical result (not a number). pi The number π Character constants: In MATLAB character constants are group of characters enclosed in single quote nothing but string. IT WORKSHOP 2018 BATCH 65 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Creating a character string is quite simple in MATLAB. In fact, we have used it many times. For example, you type the following in the command prompt – my_string = 'Tutorials Point' MATLAB will execute the above statement and return the following result − my_string = Tutorials Point MATLAB considers all variables as arrays, and strings are considered as character arrays. Let us use the whos command to check the variable created above − whos MATLAB will execute the above statement and return the following result − Name Size my_string 1x16 Bytes Class Attributes 32 char Interestingly, you can use numeric conversion functions like uint8 or uint16 to convert the characters in the string to their numeric codes. The char function converts the integer vector back to characters − Rectangular Character Array: The strings we have discussed so far are one-dimensional character arrays; however, we need to store more than that. We need to store more dimensional textual data in our program. This is achieved by creating rectangular character arrays. Simplest way of creating a rectangular character array is by concatenating two or more one-dimensional character arrays, either vertically or horizontally as required. You can combine strings vertically in either of the following ways − Using the MATLAB concatenation operator [] and separating each row with a semicolon (;). Please note that in this method each row must contain the same number of characters. For strings with different lengths, you should pad with space characters as needed. IT WORKSHOP 2018 BATCH 66 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Using the char function. If the strings are of different lengths, char pads the shorter strings with trailing blanks so that each row has the same number of characters. Using the MATLAB concatenation operator, [] and separating the input strings with a comma or a space. This method preserves any trailing spaces in the input arrays. Using the string concatenation function, strcat. This method removes trailing spaces in the inputs. MATLAB cell array can hold different sizes and types of data in an array. Cell arrays provide a more flexible way to store strings of varying length. The cellstr function converts a character array into a cell array of strings. String Functions in MATLAB: MATLAB provides numerous string functions creating, combining, parsing, comparing and manipulating strings. Following table provides brief description of the string functions in MATLAB − Function Purpose Functions for storing text in character arrays, combine character arrays, etc. blanks Create string of blank characters cellstr Create cell array of strings from character array char Convert to character array (string) iscellstr Determine whether input is cell array of strings ischar Determine whether item is character array sprintf Format data into string strcat Concatenate strings horizontally strjoin Join strings in cell array into single string IT WORKSHOP 2018 BATCH 67 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Functions for identifying parts of strings, find and replace substrings ischar Determine whether item is character array isletter Array elements that are alphabetic letters isspace Array elements that are space characters isstrprop Determine whether string is of specified category sscanf Read formatted data from string strfind Find one string within another strrep Find and replace substring strsplit Split string at specified delimiter strtok Selected parts of string validatestring Check validity of text string symvar Determine symbolic variables in expression regexp Match regular expression (case sensitive) regexpi Match regular expression (case insensitive) regexprep Replace string using regular expression regexptranslate Translate string into regular expression Functions for string comparison strcmp Compare strings (case sensitive) strcmpi Compare strings (case insensitive) strncmp Compare first n characters of strings (case sensitive) strncmpi Compare first n characters of strings (case insensitive) Functions for changing string to upper- or lowercase, creating or removing white space IT WORKSHOP 2018 BATCH 68 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING deblank Strip trailing blanks from end of string strtrim Remove leading and trailing white space from string lower Convert string to lowercase upper Convert string to uppercase strjust Justify character array Operators: An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations. MATLAB is designed to operate primarily on whole matrices and arrays. Therefore, operators in MATLAB work both on scalar and non-scalar data. MATLAB allows the following types of elementary operations − Arithmetic Operators Relational Operators Logical Operators Bitwise Operations Set Operations Arithmetic Operators MATLAB allows two different types of arithmetic operations − Matrix arithmetic operations Array arithmetic operations Matrix arithmetic operations are same as defined in linear algebra. Array operations are executed element by element, both on one-dimensional and multidimensional array. The matrix operators and array operators are differentiated by the period (.) symbol. However, as the addition and subtraction operation is same for matrices and arrays, the operator is same for both cases. The following table gives brief description of the operators − + Addition or unary plus. A+B adds the values stored in variables A and B. A and B must have the same size, unless one is a scalar. A scalar can be added to a matrix of any size. Subtraction or unary minus. A-B subtracts the value of B from A. A and B must have the same size, unless one is a scalar. A scalar can be subtracted from a matrix of any size. IT WORKSHOP 2018 BATCH 69 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING * Matrix multiplication. C = A*B is the linear algebraic product of the matrices A and B. More precisely,Matrix MultiplicationFor nonscalar A and B, the number of columns of A must be equal to the number of rows of B. A scalar can multiply a matrix of any size. .* Array multiplication. A.*B is the element-by-element product of the arrays A and B. A and B must have the same size, unless one of them is a scalar. / Slash or matrix right division. B/A is roughly the same as B*inv(A). More precisely, B/A = (A'\B')'. ./ Array right division. A./B is the matrix with elements A(i,j)/B(i,j). A and B must have the same size, unless one of them is a scalar. \ Backslash or matrix left division. If A is a square matrix, A\B is roughly the same as inv(A)*B, except it is computed in a different way. If A is an n-by-n matrix and B is a column vector with n components, or a matrix with several such columns, then X = A\B is the solution to the equation AX = B. A warning message is displayed if A is badly scaled or nearly singular. .\ Array left division. A.\B is the matrix with elements B(i,j)/A(i,j). A and B must have the same size, unless one of them is a scalar. ^ Matrix power. X^p is X to the power p, if p is a scalar. If p is an integer, the power is computed by repeated squaring. If the integer is negative, X is inverted first. For other values of p, the calculation involves eigenvalues and eigenvectors, such that if [V,D] = eig(X), then X^p = V*D.^p/V. .^ Array power. A.^B is the matrix with elements A(i,j) to the B(i,j) power. A and B must have the same size, unless one of them is a scalar. ' Matrix transpose. A' is the linear algebraic transpose of A. For complex matrices, this is the complex conjugate transpose. .' Array transpose. A.' is the array transpose of A. For complex matrices, this does not involve conjugation. Relational Operators: Relational operators can also work on both scalar and non-scalar data. Relational operators for arrays perform element-by-element comparisons between two arrays and return a logical array of the same size, with elements set to logical 1 (true) where the relation is true and elements set to logical 0 (false) where it is not. The following table shows the relational operators available in MATLAB − IT WORKSHOP 2018 BATCH 70 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING 1 < Less than 2 <= Less than or equal to 3 > Greater than 4 >= Greater than or equal to 5 == Equal to 6 ~= Not equal to Logical Operators: MATLAB offers two types of logical operators and functions − Element-wise − These operators operate on corresponding elements of logical arrays. Short-circuit − These operators operate on scalar and, logical expressions. Element-wise logical operators operate element-by-element on logical arrays. The symbols &, |, and ~ are the logical array operators AND, OR, and NOT. Short-circuit logical operators allow short-circuiting on logical operations. The symbols && and || are the logical short-circuit operators AND and OR. Bitwise Operations: Bitwise operators work on bits and perform bit-by-bit operation. The truth tables for &, |, and ^ are as follows − p q p &qp |q p ^q 0 0 0 0 0 0 1 0 1 1 1 1 1 1 0 1 0 0 1 1 IT WORKSHOP 2018 BATCH 71 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING MATLAB provides various functions for bit-wise operations like 'bitwise and', 'bitwise or' and 'bitwise not' operations, shift operation, etc. bitand(a, b) Bit-wise AND of integers a and b bitcmp(a) Bit-wise complement of a bitget(a,pos) Get bit at specified position pos, in the integer array a bitor(a, b) Bit-wise OR of integers a and b bitset(a, pos) Set bit at specific location pos of a bitshift(a, k) Returns a shifted to the left by k bits, equivalent to multiplying by 2k. Negative values of k correspond to shifting bits right or dividing by 2|k| and rounding to the nearest integer towards negative infinite. Any overflow bits are truncated. bitxor(a, b) Bit-wise XOR of integers a and b swapbytes Swap byte ordering Set Operations: MATLAB provides various functions for set operations, like union, intersection and testing for set membership, etc. The following table shows some commonly used set operations intersect(A,B) Set intersection of two arrays; returns the values common to both A and B. The values returned are in sorted order. intersect(A,B,'rows') Treats each row of A and each row of B as single entities and returns the rows common to both A and B. The rows of the returned matrix are in sorted order. ismember(A,B) Returns an array the same size as A, containing 1 (true) where the elements of A are found in B. Elsewhere, it returns 0 (false). ismember(A,B,'rows') Treats each row of A and each row of B as single entities and returns a vector containing 1 (true) where the rows of matrix A are also rows of B. Elsewhere, it returns 0 (false). issorted(A) Returns logical 1 (true) if the elements of A are in sorted order and logical 0 (false) otherwise. Input A can be a vector or an Nby-1 or 1-by-N cell array of strings. A is considered to be sorted if A and the output of sort(A) are equal. issorted(A, 'rows') Returns logical 1 (true) if the rows of twodimensional matrix A is in sorted order, and logical 0 (false) otherwise. Matrix A is considered to be sorted if A and the output of sortrows(A) are equal. IT WORKSHOP 2018 BATCH 72 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING setdiff(A,B) Sets difference of two arrays; returns the values in A that are not in B. The values in the returned array are in sorted order. setdiff(A,B,'rows') Treats each row of A and each row of B as single entities and returns the rows from A that are not in B. The rows of the returned matrix are in sorted order.The 'rows' option does not support cell arrays. Setxor Sets exclusive OR of two arrays unionSets union of two arrays unique Unique values in array Control Structures: For loops, While, If control structures, Switch, Break, Continue statements. Decision making structures require that the programmer should specify one or more conditions to be evaluated or tested by the program, along with a statement or statements to be executed if the condition is determined to be true, and optionally, other statements to be executed if the condition is determined to be false. Following is the general form of a typical decision making structure found in most of the programming languages – Decision making statements in MATLAB MATLAB provides following types of decision making statements. if ... end statement-An if ... end statement consists of a boolean expression followed by one or more statements. if...else...end statement-An if statement can be followed by an optional else statement, which executes when the boolean expression is false. If... elseif...elseif...else...end statements-An if statement can be followed by one (or more) optional elseif... and an else statement, which is very useful to test various conditions. nested if statements-You can use one if or elseif statement inside another if or elseif statement(s). switch statement-A switch statement allows a variable to be tested for equality against a list of values. nested switch statements-You can use one switch statement inside another switch statement(s). MATLAB provides following types of loops to handle looping requirements. IT WORKSHOP 2018 BATCH 73 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING while loop-Repeats a statement or group of statements while a given condition is true. It tests the condition before executing the loop body. for loop-Executes a sequence of statements multiple times and abbreviates the code that manages the loop variable. nested loops-You can use one or more loops inside any another loop. Loop Control Statements: Loop control statements change execution from its normal sequence. When execution leaves a scope, all automatic objects that were created in that scope are destroyed. MATLAB supports the following control statements. break statement-Terminates the loop statement and transfers execution to the statement immediately following the loop. continue statement-Causes the loop to skip the remainder of its body and immediately retest its condition prior to reiterating. Program: 1.Arithmetic operators a = 10; b = 20; c=a+b d=a-b e=a*b f=a/b g=a\b x = 7; y = 3; z=x^y Output: IT WORKSHOP 2018 BATCH 74 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING c d e f g z = 30 = -10 = 200 = 0.50000 = 2 = 343 Program: 2.Relational operators % comparing two values a = 100; b = 200; if (ge(a,b)) max = a else max = b end % comparing two different values a = 340; b = 520; if (le(a, b)) disp(' a is either less than or equal to b') else disp(' a is greater than b') end Output: max = 200 IT WORKSHOP 2018 BATCH 75 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING a is either less than or equal to b Program: 3.Logical operators a = 5; b = 20; if ( a && b ) disp('Line 1 - Condition is true'); end if ( a || b ) disp('Line 2 - Condition is true'); end % lets change the value of a and b a = 0; b = 10; if ( a && b ) disp('Line 3 - Condition is true'); else disp('Line 3 - Condition is not true'); end if (~(a && b)) disp('Line 4 - Condition is true'); end IT WORKSHOP 2018 BATCH 76 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Output: Line Line Line Line 1 2 3 4 - Condition Condition Condition Condition is is is is true true not true true Program: 4.Bit operations a = 60; % 60 = 0011 1100 b = 13; % 13 = 0000 1101 c = bitand(a, b) % 12 = 0000 1100 c = bitor(a, b) % 61 = 0011 1101 c = bitxor(a, b) % 49 = 0011 0001 c = bitshift(a, 2) % 240 = 1111 0000 */ c = bitshift(a,-2) % 15 = 0000 1111 */ Output: c c c c c = = = = = 12 61 49 240 15 Program: 5.Set operations a= [7 23 14 15 9 12 8 24 35] b = [ 2 5 7 8 14 16 25 35 27] u = union(a, b) i = intersect(a, b) s = setdiff(a, b) IT WORKSHOP 2018 BATCH 77 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Output: a = 7 23 14 15 9 12 8 24 35 2 5 7 8 14 16 25 35 27 2 5 7 8 9 12 14 15 16 7 8 14 35 9 12 15 23 b = u = 23 24 25 27 35 i = s = 24 Program: 6.If else a = 100; % check the boolean condition if a < 20 % if condition is true then print the following fprintf('a is less than 20\n' ); else % if condition is false then print the following fprintf('a is not less than 20\n' ); end fprintf('value of a is : %d\n', a); IT WORKSHOP 2018 BATCH 78 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Output: a is not less than 20 value of a is : 100 Program: 7.For loop for a = 1.0: -0.1: 0.0 disp(a) end Output: 1 0.90000 0.80000 0.70000 0.60000 0.50000 0.40000 0.30000 0.20000 0.10000 0 Program: 8.While loop a = 10; % while loop execution while (a < 20 ) fprintf('value of a: %d\n', a); a = a + 1; if( a > 15) % terminate the loop using break statement IT WORKSHOP 2018 BATCH 79 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING break; end end Output: value value value value value value of of of of of of a: a: a: a: a: a: 10 11 12 13 14 15 Program: 9.Continue a = 9; %while loop execution while a < 20 a = a + 1; if a == 15 % skip the iteration continue; end fprintf('value of a: %d\n', a); end Output: value value value value value of of of of of a: a: a: a: a: 10 11 12 13 14 IT WORKSHOP 2018 BATCH 80 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING value value value value value of of of of of a: a: a: a: a: 16 17 18 19 20 Program: 10.Break Output: Program: 11.Switch grade = 'B'; switch(grade) case 'A' fprintf('Excellent!\n' ); case 'B' fprintf('Well done\n' ); case 'C' fprintf('Well done\n' ); case 'D' fprintf('You passed\n' ); case 'F' fprintf('Better try again\n' ); otherwise fprintf('Invalid grade\n' ); end IT WORKSHOP 2018 BATCH 81 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Output: Well done IT WORKSHOP 2018 BATCH 82 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING TASK 11 Input-Output functions, Reading and Storing Data. Vectors and Matrices, commands to operate on vectors and matrices, matrix Manipulations. Input-Output functions: MATLAB provides three different techniques to read data from files and save data into files: • using the load and save commands, • using other commands for loading and saving plain ASCII files, • using low-level input/ output functions for other file formats. Load and save commands The save command is used for saving all the variables of the base (command line) workspace into a file. The filename must be specified after the save command: >>save filename MATLAB creates a binary file of .mat extension in the current folder (the general format of .mat files is described in the documentation). The variables stored in a MATLAB binary format file can be read in by using the load command: >>load filename If not all the variables are needed to save or load, the names of the required variables must be listed after the name of the file in the command line. >>save filename var1 var2 .. varN >>load filename var1 var 2 This type of data input and output is suggested when the actual MATLAB workflow has to be finished temporarily, but later it is planned to continue with the variables created in the previous MATLAB session. IT WORKSHOP 2018 BATCH 83 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING The file of MATLAB binary format, however, cannot be processed by other software environments (e.g. spreadsheet or word-processing software). Loading and saving plain ASCII files The MATLAB provides some useful built-in functions by which tabular format data sets can be saved in plain ASCII coded files and data can also be loaded in the workspace from such files. >>csvwrite('filename.ext', M) writes the matrix M into the file specified between single quotes. The numbers are separated by commas and arranged in a tabular format. >>M = csvread('filename.ext') reads the data from a comma-separated file whose name and extension are specified between single quotes. The file can only contain numeric values in a tabular format. The data are loaded in the matrix M. >>M = csvread('filename.ext', R, C) reads the data from a comma-separated file starting at row R and column C. The numbering of rows and columns starts with 0. This way of calling csvread can be useful when the first row in the file is a header. >>dlmwrite('filename.ext',M,'dlm') writes the matrix M into the file specified between single quotes. The numbers are separated by using the character dlm as the delimiter of data columns. A frequently applied delimiter: horizontal tabulator '\t' >>M= dlmread('filename.ext','dlm') reads the data from the file specified between single quotes. IT WORKSHOP 2018 BATCH 84 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING The file can only contain numeric values in a tabular format, and the numbers are separated by using the character dlm as the delimiter of data columns. The data are loaded in the matrix M. >>M= dlmread('filename.ext','dlm', R, C) reads the data from the file starting at row R and column C. The numbering of rows and columns starts with 0. Reading and Storing Data: Importing data in MATLAB means loading data from an external file. The importdata function allows loading various data files of different formats. It has the following five forms − A = importdata(filename)-Loads data into array A from the file denoted by filename. A = importdata('-pastespecial')-Loads data from the system clipboard rather than from a file. A = importdata(___, delimiterIn)-Interprets delimiterIn as the column separator in ASCII file, filename, or the clipboard data. You can use delimiterIn with any of the input arguments in the above syntaxes. A = importdata(___, delimiterIn, headerlinesIn)-Loads data from ASCII file, filename, or the clipboard, reading numeric data starting from line headerlinesIn+1. [A, delimiterOut, headerlinesOut] = importdata(___)-Returns the detected delimiter character for the input ASCII file in delimiterOut and the detected number of header lines in headerlinesOut, using any of the input arguments in the previous syntaxes. Program: filename = 'weeklydata.txt'; delimiterIn = ' '; headerlinesIn = 1; A = importdata(filename,delimiterIn,headerlinesIn); % View data IT WORKSHOP 2018 BATCH 85 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING for k = [1:7] disp(A.colheaders{1, k}) disp(A.data(:, k)) disp(' ') end Output: SunDay 95.0100 73.1100 60.6800 48.6000 89.1300 MonDay 76.2100 45.6500 41.8500 82.1400 44.4700 TuesDay 61.5400 79.1900 92.1800 73.8200 57.6300 WednesDay 40.5700 93.5500 91.6900 41.0300 89.3600 ThursDay 55.7900 75.2900 81.3200 0.9900 13.8900 FriDay 70.2800 69.8700 90.3800 67.2200 IT WORKSHOP 2018 BATCH 86 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING 19.8800 SaturDay 81.5300 74.6800 74.5100 93.1800 46.6000 Vectors and Matrices,Commands to operate on vectors and matrices: A vector is a one-dimensional array of numbers. MATLAB allows creating two types of vectors − Row vectors Column vectors Row Vectors: Row vectors are created by enclosing the set of elements in square brackets, using space or comma to delimit the elements. r = [7 8 9 10 11] MATLAB will execute the above statement and return the following result − r= 7 8 9 10 11 Column Vectors: Column vectors are created by enclosing the set of elements in square brackets, using semicolon to delimit the elements. c = [7; 8; 9; 10; 11] MATLAB will execute the above statement and return the following result − c= 7 8 9 10 IT WORKSHOP 2018 BATCH 87 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING 11 Referencing the Elements of a Vector: You can reference one or more of the elements of a vector in several ways. The ith component of a vector v is referred as v(i). For example − v = [ 1; 2; 3; 4; 5; 6]; % creating a column vector of 6 elements v(3) MATLAB will execute the above statement and return the following result − ans = 3 When you reference a vector with a colon, such as v(:), all the components of the vector are listed. v = [ 1; 2; 3; 4; 5; 6]; % creating a column vector of 6 elements v(:) MATLAB will execute the above statement and return the following result − ans = 1 2 3 4 5 6 MATLAB allows you to select a range of elements from a vector. For example, let us create a row vector rv of 9 elements, then we will reference the elements 3 to 7 by writing rv(3:7) and create a new vector named sub_rv. rv = [1 2 3 4 5 6 7 8 9]; sub_rv = rv(3:7) IT WORKSHOP 2018 BATCH 88 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING MATLAB will execute the above statement and return the following result − sub_rv = 3 4 5 6 7 Vector Operations In this section, let us discuss the following vector operations − Addition and Subtraction of Vectors Scalar Multiplication of Vectors Transpose of a Vector Appending Vectors Magnitude of a Vector Vector Dot Product A matrix is a two-dimensional array of numbers. In MATLAB, you create a matrix by entering elements in each row as comma or space delimited numbers and using semicolons to mark the end of each row. For example, let us create a 4-by-5 matrix a − a = [ 1 2 3 4 5; 2 3 4 5 6; 3 4 5 6 7; 4 5 6 7 8] MATLAB will execute the above statement and return the following result − a= 1 2 3 4 5 2 3 4 5 6 3 4 5 6 7 4 5 6 7 8 Referencing the Elements of a Matrix: To reference an element in the mth row and nth column, of a matrix mx, we write − mx(m, n); IT WORKSHOP 2018 BATCH 89 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING For example, to refer to the element in the 2nd row and 5th column, of the matrix a, as created in the last section, we type − a = [ 1 2 3 4 5; 2 3 4 5 6; 3 4 5 6 7; 4 5 6 7 8]; a(2,5) MATLAB will execute the above statement and return the following result − ans = 6 To reference all the elements in the mth column we type A(:,m). Let us create a column vector v, from the elements of the 4th row of the matrix a − a = [ 1 2 3 4 5; 2 3 4 5 6; 3 4 5 6 7; 4 5 6 7 8]; v = a(:,4) MATLAB will execute the above statement and return the following result − v= 4 5 6 7 You can also select the elements in the mth through nth columns, for this we write − a(:,m:n) Let us create a smaller matrix taking the elements from the second and third columns − a = [ 1 2 3 4 5; 2 3 4 5 6; 3 4 5 6 7; 4 5 6 7 8]; a(:, 2:3) MATLAB will execute the above statement and return the following result − ans = IT WORKSHOP 2018 BATCH 90 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING 2 3 3 4 4 5 5 6 In the same way, you can create a sub-matrix taking a sub-part of a matrix. a = [ 1 2 3 4 5; 2 3 4 5 6; 3 4 5 6 7; 4 5 6 7 8]; a(:, 2:3) MATLAB will execute the above statement and return the following result − ans = 2 3 3 4 4 5 5 6 In the same way, you can create a sub-matrix taking a sub-part of a matrix. For example, let us create a sub-matrix sa taking the inner subpart of a− 3 4 5 4 5 6 To do this, write − a = [ 1 2 3 4 5; 2 3 4 5 6; 3 4 5 6 7; 4 5 6 7 8]; sa = a(2:3,2:4) MATLAB will execute the above statement and return the following result − sa = 3 4 5 IT WORKSHOP 2018 BATCH 91 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING 4 5 6 Deleting a Row or a Column in a Matrix: You can delete an entire row or column of a matrix by assigning an empty set of square braces [] to that row or column. Basically, [] denotes an empty array. For example, let us delete the fourth row of a − a = [ 1 2 3 4 5; 2 3 4 5 6; 3 4 5 6 7; 4 5 6 7 8]; a( 4 , : ) = [] MATLAB will execute the above statement and return the following result − a= 1 2 3 4 5 2 3 4 5 6 3 4 5 6 7 Next, let us delete the fifth column of a − a = [ 1 2 3 4 5; 2 3 4 5 6; 3 4 5 6 7; 4 5 6 7 8]; a(: , 5)=[] MATLAB will execute the above statement and return the following result − a= 1 2 3 4 2 3 4 5 3 4 5 6 4 5 6 7 Example: In this example, let us create a 3-by-3 matrix m, then we will copy the second and third rows of this matrix twice to create a 4-by-3 matrix. Create a script file with the following code − IT WORKSHOP 2018 BATCH 92 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING a = [ 1 2 3 ; 4 5 6; 7 8 9]; new_mat = a([2,3,2,3],:) When you run the file, it displays the following result − new_mat = 4 5 6 7 8 9 4 5 6 7 8 9 Matrix Operations: In this section, let us discuss the following basic and commonly used matrix operations − Addition and Subtraction of Matrices Division of Matrices Scalar Operations of Matrices Transpose of a Matrix Concatenating Matrices Matrix Multiplication Determinant of a Matrix Inverse of a Matrix Matrix Manipulations: Program: 1.Addition and subtraction a = [ 1 2 3 ; 4 5 6; 7 8 9]; b = [ 7 5 6 ; 2 0 8; 5 7 1]; c=a+b d=a-b Output: c = 8 6 12 7 5 15 IT WORKSHOP 9 14 10 2018 BATCH 93 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING d = -6 2 2 -3 5 1 -3 -2 8 Program: 2.Division a = [ 1 2 3 ; 4 5 6; 7 8 9]; b = [ 7 5 6 ; 2 0 8; 5 7 1]; c=a/b d=a\b Output: c = -0.52542 -0.42373 -0.32203 0.68644 0.94068 1.19492 0.66102 1.01695 1.37288 -1.05556 0.11111 1.27778 -4.86111 -0.27778 4.30556 d = -3.27778 -0.11111 3.05556 Program: 3.Scalar operations a = [ 10 12 23 ; 14 8 6; 27 8 9]; b = 2; c=a+b d=a-b e=a*b f=a/b Output: c = 12 16 29 14 10 10 25 8 11 d = 8 10 IT WORKSHOP 21 2018 BATCH 94 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING e = 12 25 6 6 4 7 20 28 54 24 16 16 46 12 18 f = 5.0000 7.0000 13.5000 6.0000 4.0000 4.0000 11.5000 3.0000 4.5000 Program: 4.Transpose a = [ 10 12 23 ; 14 8 6; 27 8 9] b = a' Output: a = 10 14 27 12 8 8 23 6 9 10 12 23 14 8 6 27 8 9 b = Program: 5.Concatenation a = [ 10 12 23 ; 14 8 6; 27 8 9] b = [ 12 31 45 ; 8 0 -9; 45 2 11] c = [a, b] d = [a; b] Output: a = 10 14 27 12 8 8 23 6 9 12 8 45 31 0 2 45 -9 11 10 12 23 b = c = IT WORKSHOP 12 31 45 2018 BATCH 95 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING d = 14 27 8 8 6 9 10 14 27 12 8 45 12 8 8 31 0 2 23 6 9 45 -9 11 8 45 0 2 -9 11 Program: 6.Multiplication a = [ 1 2 3; 2 3 4; 1 2 5] b = [ 2 1 3 ; 5 0 -2; 2 3 -1] prod = a * b Output: a = b = 1 2 1 2 3 2 3 4 5 2 5 2 1 0 3 3 -2 -1 18 27 22 10 14 16 prod = -4 -4 -6 Program: 7.Determinant a = [ 1 2 3; 2 3 4; 1 2 5] det(a) Output: a = 1 2 1 ans = -2 2 3 2 3 4 5 Program: 8.Inverse IT WORKSHOP 2018 BATCH 96 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING a = [ 1 2 3; 2 3 4; 1 2 5] inv(a) Output: a = 1 2 2 3 1 2 ans = -3.5000 3.0000 -0.5000 3 4 5 2.0000 -1.0000 0 IT WORKSHOP 0.5000 -1.0000 0.5000 2018 BATCH 97 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING TASK 12 Arithmetic operations on Matrices, Relational operations on Matrices, Logical operations on Matrices, Polynomial Evaluation, Roots of Polynomial, Arithmetic operations on Polynomials. Arithmetic operations on Matrices: Array Addition-a+b-Array & matrix addition are identical Array Subtraction - a-b -Array & matrix subtraction are identical Array Multiplication-a.*b-Array multiplication element by element multiplication of a & b Matrix Multiplication-a*b-For matrix multiplication no of a column in matrix a=no of a column of matrix b Array Right Division-a./b-Element by element division of a & b Array Left Division -a.\b-Element by element division of a & b within the Numerator. Matrix Right Division-a/b- a*inv(b) where inv represent inverse Matrix Left Division-a\b- inv(a)*b Array Exponential-a.^b-Element by element exponential of a & b i.e a(i , j) ^ b( i , j) Program: >>b=[4,5;6,7] b= 4 5 6 7 >> c= [5,8;9,8] c= 5 8 9 8 >> b+c ans = 9 13 15 15 IT WORKSHOP 2018 BATCH 98 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING >> b-c ans = -1 -3 -3 -1 >> b.^c ans = 1024 390625 10077696 5764801 >> b./c ans = 0.8000 0.6250 0.6667 0.8750 >> b.\c ans = 1.2500 1.6000 1.5000 1.1429 Relational operations on Matrices: == Equal to ~= Not equal to > Greater than >= Greater than equal to < Less than <= Less than equal to Program: >>b=[4,5;6,7] b= 4 5 IT WORKSHOP 2018 BATCH 99 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING 6 7 >> c=[5,8;9,8] c= 5 8 9 8 >> b>c ans = 0 0 0 0 >> c>b ans = 1 1 1 1 >> c==b ans = 0 0 0 0 >> 'd'<'a' ans = 0 Logical operations on Matrices: o o &&: Logical AND with shortcut evaluation. If the first expression is false, return false instead of calculating the second expression. It works only between scaler values. Faster because of partial evaluation. &: Logical AND Evaluates both expressions. It works with both scaler and array values. IT WORKSHOP 2018 BATCH 100 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING ||: Logical inclusive OR with shortcut evaluation. If the first expression is true, return true instead of calculating the second expression It works only between scaler values. Faster because of partial evaluation. |: Logical OR Evaluates both expressions. It works with both scaler and array values. XOR: Logical exclusive OR It returns true if and only if one operand is true and other is false. o o o Program: >>b=[4,5;6,7] b= 4 5 6 7 >> c=[5,8;9,8] c= 5 8 9 8 >> b&c ans = 1 1 1 1 >> b|c ans = 1 1 1 1 >> xor(b,c) ans = 0 0 IT WORKSHOP 2018 BATCH 101 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING 0 0 >> ~b ans = 0 0 0 0 Polynomial Evaluation: The polyval function is used for evaluating a polynomial at a specified value. For example, to evaluate our previous polynomial p, at x = 4, type – Program: p = [1 7 0 -5 9]; polyval(p,4) MATLAB executes the above statements and returns the following result Output: ans = 693 MATLAB also provides the polyvalm function for evaluating a matrix polynomial. A matrix polynomial is a polynomial with matrices as variables. For example, let us create a square matrix X and evaluate the polynomial p, at X – Program: p = [1 7 0 -5 9]; X = [1 2 -3 4; 2 -5 6 3; 3 1 0 2; 5 -7 3 8]; polyvalm(p, X) MATLAB executes the above statements and returns the following result – Output: ans = 2307 -1769 IT WORKSHOP -939 4499 2018 BATCH 102 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING 2314 -2376 -249 4695 2256 -1892 -549 4310 4570 -4532 -1062 9269 Roots of Polynomial: The roots function calculates the roots of a polynomial. For example, to calculate the roots of our polynomial p, type – Program: p = [1 7 0 -5 9]; r = roots(p) MATLAB executes the above statements and returns the following result Output: r= -6.8661 + 0.0000i -1.4247 + 0.0000i 0.6454 + 0.7095i 0.6454 - 0.7095i The function poly is an inverse of the roots function and returns to the polynomial coefficients. For example – Program: p2 = poly(r) MATLAB executes the above statements and returns the following result Output: p2 = Columns 1 through 3: 1.00000 + 0.00000i 7.00000 + 0.00000i 0.00000 + 0.00000i Columns 4 and 5: -5.00000 - 0.00000i 9.00000 + 0.00000i IT WORKSHOP 2018 BATCH 103 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Arithmetic operations on Polynomials: Addition: Two polynomials can be added or subtracted by adding the vectors of the coefficients. If the two polynomials do not have the same order (which mean the coefficient vectors are not of the same length), the shorter vectors has to be modified to have the same length as the longer one by adding zeros in front. For example, to compute (3x^6-2x^5+10x^4 -x^3 +7 ) + (x^3 -2x - 4) we first use p and q to represent the two polynomials respectively >> p = [3 -2 10 -1 0 0 7]; >> q = [1 0 -2 -4] The polynomial q has degree 3, we need to add 3 zeros since p has order 6: >> p+[0 0 0 q] ans = 3 -2 10 0 0 -2 3 Then we read that the summation is 3x^6-2x^5+10x^4-2x+3 Multiplication: Two polynomials can be multiplied by using the command conv which has the form: r = conv(p,q) where p,q are the coefficient vectors that are being multiplied and r is the coefficient vector of the product. For example, the multiplication of 3x-2 and 5x^2-1 is done by: >> conv([3 -2],[5 0 -1]) ans = 15 -10 -3 2 The result is the polynomial 15x^3-10x^2-3x+2. Note that the two polynomials that are being multiplied do not have to be the same order. IT WORKSHOP 2018 BATCH 104 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Multiplication of three or more polynomials is done by using conv command repeatedly. Division: A polynomial can be divided by another polynomial with the command deconv that has the form: [q,r] = deconv(u,v) u is the numerator polynomial v is the denominator polynomial q is the quotient polynomial r is the remainder polynomial For example, dividing 2x^3+7x^2-5x-2 by x+3 is done by: >> [q,r] = deconv([2 7 -5 -2],[1 3]) q= 2 1 -8 0 0 0 r= 22 The answer is 2x^2+x-8 and the remainder is 22. IT WORKSHOP 2018 BATCH 105 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING TASK 15 Installation of Windows and Linux OS Steps to install windows: Open VMWare software. Create a new virtual machine. Select Typical Click on Next. Select store Virtual disk as a single file. Clock on Next. Click on Customize hardware. Select new CD/DVD.Now select Use ISO image file,browse for iso location. Click on close. Click on finish. Now a new window is opened. Click on power on. We see windows set up screen. Click on Next. Click on Install now. On Activate windows screen enter Windows product key. Click on Next. Accept license agreement. Click on Next. Then select option,Custom:Install the windows only. Then we need to do memory partition.We see drive 0 Unallocated. Click on new by selecting Drive 0. Allocate 20000KB. Click select. Repeat the same,allocate 20000 value for remaining also. Drive 0 Partiton 1 500MB Drive 0 Partiton 2 20GB Drive 0 Partiton 3 20GB Drive 0 Partiton 4 19GB Then windows gets installed. We see customize settings option. Select express settings. IT WORKSHOP 2018 BATCH 106 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Set up Microsoft account. Click on Next. We see the message getting apps ready. Then we see desktop. Installation of Linux: Open VMWare software. Click on create new virtual machine. Select typical. Click on Next. Then select option I will install later. Name the virtual machine. Select the option Click disk into multiple files. Click on Next. Click on Customize hardware. Select new CD/DVD.Click on use ISO image file.Browse the file. Click on Close. Click on Finish. Now power on virtual machine. Click on install Ubuntu. Click continue. On installation type window,click on something else. Click on continue. We see /dev/sda window. We need to do memory partition. Click on partition table. Then click new. Click continue. Click on +.Select type of new partition Primary. Select size 150MB. Location for new partition:Beginning of this space. Select mount point as 1 boot. Again click + Size:2028MB Type of new partition:Logical Select use as swap area Again click +.Select the mount point as /. IT WORKSHOP 2018 BATCH 107 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Then we get a window. Click on Hyderabad. Click continue. Click on English(US) then loading occurs. Set user name,password. Click on continue(if continue tab not visible click tab,tab,tab,then enter) Now installation starts. We see login screen. IT WORKSHOP 2018 BATCH 108