Experiment # 1
Title: Starting with MATLAB.
Equipment Required: Personal computer (PC) with windows operating system and MATLAB software

Theory:-
MATLAB is a powerful computing system for handling the calculations involved in scientific and engineering problems. The name MATLAB stands for MATrix LABoratory, because the system was designed to make matrix computations particularly easy. One of the many things about MATLAB (and which distinguishes it from many other computer programming systems, such as C++ and Java) is that you can use it interactively. This means you type some commands at the special MATLAB prompt, and get the answers immediately. The problems solved in this way can be very simple, like finding a square root, or they can be much more complicated, like finding the solution to a system of differential equations. For many technical problems you have to enter only one or two commands, and you get the answers at once.

Problems:-
Solve the following problems in the Command Window.

...DISCUSSION:
After using both languages, Microsoft Excel and MATLAB (MATrix LABoratory), on the same module experiments from 1 to 4, I observed the following:
* For Microsoft excel,
* It uses spreadsheet application where each elements or data values are distributed in cells.
* Most statistical computations are easy to solve due to the manner of data organization where data are inserted on cells arranged in numbered rows and letter-named columns.
* It is easy to plot the selected values by just choosing the selected data then use the chart tools/design tab.
* The Disadvantage of this language are as follows:
* Difficulty in debugging the error
* Limited set of statistical tools
* In the case of excessively large results, Excel returns #NUM! instead of an answer
* Inability to handle large datasets
* For MATLAB,
* It uses matrix based algorithms hence each element or data values are treated in an m row by n column, such that a single integer is considered a matrix of one row and one column.
* Manipulation of vectors is easily done by one command.
* To plot, matlab needs to use certain algorithms which are compiled in an M-file.
* The Disadvantage of this language are as follows:
* Expensive wherein every single toolbox has to be paid due to its licensure
* It uses a huge amount of computer...

...AP Induction Week Course
Introduction to Engineering Computation
Laboratory Manual
MATLAB programming
Department of Engineering Science
MATLAB Laboratory Manual Contents
Laboratory 1: An introduction to MATLAB ............................................................................................ 2 Laboratory 2: Debugging, Functions and Problem Solving ............................................................22 Laboratory 3: Logical Operators, Conditional Statements and Loops ........................................32 Laboratory 4: Graphics and Image Processing ...................................................................................46 Laboratory 5: Strings and Files ................................................................................................................52 Laboratory 6: Linear equations and differential equations ..........................................................57
Laboratory 1: An introduction to MATLAB
GETTING STARTED
Your Tutor will show you how to login to the Network. Most of the applications you will use reside on File Servers rather than on the local hard drive of your computer. You have also been allocated an ec (Electronic Campus) home directory (H drive), in which you can save your work. If your computer is switched off (you can tell this by the absence of a light on the front of the computer) you should press the Power on the computer’s...

...Using Matlab to Execute a Genetic Algorithm
Optimization of Two Variable Function
The function to be optimized is given by:
[pic]
The maximum value of this two variable function is desired, however Matlab’s gatool finds the minimum of fitness functions and so as in the previous example the function must be altered as follows:
[pic]
Now we must enter this function, as before, into a Matlab function file.
Start Matlab and change the working directory to your Knowledge Based Systems folder. (i.e. U:\Current Class\KBS\) Create an m-file by either typing “edit fitness2” at the command prompt, or clicking the new file icon on the toolbar.
The Matlab Genetic Algorithm accepts multiple variable functions, however these variables must be contained in an array. Therefore every “x” in the above equation is replaced with “x(1)” and every “y” with “x(2)”. Once the m-file editor is open, enter the following code:
function y = fitness2(x)
y = -((1-x(1))^2*exp(-x(1)^2-(x(2)+1)^2) - (x(1) - x(1)^3 - x(2)^3)*exp(-x(1)^2-x(2)^2));
end
Save the file. (Note: The file must be saved under the same name as the function name. i.e. fitness2 as shown above)
In the Matlab command window type “gatool”. This will open the genetic algorithm tool as shown in Figure 1.
[pic]
Enter the name of your fitness function in the Fitness function text box preceded with an @ symbol as...

... ASSISTANT PROFESSOR
CONTENTS:
1)Experiment 1: INTRODUCTION WITH MATLAB SOFTWARE
2) Experiment 2: GENERATION OF BASIC CONTINUES SIGNALS / BASIC DISCRETE SIGNALS
3) Experiment 3: IMPULSE RESPONSE OF AN LTI SYSTEM
4) Experiment 4: CONVOLUTION OF TWO SEQUENCE AND PROPERTIES OF CONVOLUTION
5) Experiment 5: CORRELATION- AUTOCORRELATION
6) Experiment 6: read and display digital image using MATLAB
7) Experiment 7: remove noise using spatial filters.
8) Experiment 8: edge detection using quick mask.
9) Experiment 9: histogram calculation and equalization.
(Without using standard functions)
10) Experiment 10: image morphological operations erosion and dilation.
Experiment No: - 01
FAMILIARISATION WITH MATLAB R2011B
Aim: To familiarise with MATLAB software, general functions and signal processing toolbox functions.
The name MATLAB stands for Matrix Laboratory produced by Math works Inc., USA. It is a matrix-based
powerful software package for scientific and engineering computation and visualization. Complex numerical problems can be solved in a fraction of the time that required with other high level languages. It provides an...

...allocated to these courses
in the timetable
• These slots will be used in weeks 2-4
– Throughout term a PC lab session is available every
week
• Students should attend lab sessions when possible
Semester 1, 2014-2015
Structure of EG-264
• Two components
– MATLAB – Revision, Numerical Integration, Root
Finding
• Dr Mike Clee
• Lectures – Weeks 2-4, Labs – Weeks 3-5
• 50% 1 assignment
– CAD – Solidworks
• Dr Chengyuan Wang
• Lectures Weeks 5-6, Labs – Weeks 6-12
• 50% – 1 assignments
Semester 1, 2014-2015
General Information
• MATLAB lab slots
– There will be demonstrators in each lab to help with MATLAB
worksheets
– Each student has the opportunity to complete the assignment during
the lab sessions
– Remember - MATLAB labs will be held between Week 3 and Week 5
this is where help will be available.
• Every year, over 40% of level-3 research projects involve the use
of MATLAB
– The only way to master MATLAB is to practice!
– Revision worksheets are available on Blackboard for practice in your
own time during weeks 3-5
– Should also put the examples from the lecture notes into MATLAB
– Try to understand what each command is doing
Semester 1, 2014-2015
Assessment – MATLAB 1 component
• You will be asked to submit your MATLAB solutions
to specific problems
– Worth 50% of total marks for the module
– Assignment will be made available on...

...MATLAB EXERCISES
UEMH3163 / UECS2053 ARTIFICIAL INTELLIGENCE
1. Run the MATLAB code:
a = 1:5;
d = a+i*a;
e = d'
f = d.'
g = mod(5,4)
2. Given A = [1 2 4; 1 1 1; 2 3 1] and B = [2 2 2; 2 2 2; 2 2 2]. Run the MATLAB code:
a=A>B
b=A>1
3. Given A = magic(4). Run MATLAB code :
DiagElement = diag(A)
DiagMatrix = diag(diag(A))
SuperDiagElement = diag(A,2)
4. Run the MATLAB code:
name = upper('matlab')
fun = strrep('hahaha','a','i')
greet = 'Welcome';
where = 'to Joan''s';
party = 'birthday party';
¯nal = str2mat(greet, where, party)
text = 'Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday';
[day,rest] = strtok(text,',')
[day2,rest] = strtok(rest,',')
5. Given A = [1 1; 2 2; 3 3; 4 100]. Run the MATLAB code :
average = mean(A)
med = median(A)
dev = std(A)
6. Given A = [0 4 4; 2 0 2; 4 2 0]. Run the MATLAB code :
[Ascend,Ind] =sort(A)
Descend = ﬂipud(sort(A))
7. Let be given the string 'Need-to-split-this-string'. We want to break it into the 5 strings 'Need', 'to',
'split', 'this', and 'string'.
8. Given A = [1 2 5 5 6 2 1 2]. Write a code that removes all 2's in matrix A.
9. Given A = [2 8 3 30 4 50 100 200 4 80 500]. Split it into three arrays with different ranges: (0-10),
(10-100), and (100-1000). The above array should become
a = [2 8 3 4 4]
b = [30 50 80]
c = [100; 200; 500]
10. Given A = [1 2 3;4 5 6;7 8 10] and...

...MATLAB Parallel Computing
John Burkardt (ARC/ICAM) & Gene Cliﬀ (AOE/ICAM) Virginia Tech .......... FDI Fall Short Course: Introduction to Parallel MATLAB at Virginia Tech http://people.sc.fsu.edu/∼burkardt/presentations/fdi matlab 2009.pdf .......... ARC: Advanced Research Computing AOE: Department of Aerospace and Ocean Engineering ICAM: Interdisciplinary Center for Applied Mathematics
09 September 2009
Burkardt MATLAB Parallel Computing
MATLAB Parallel Computing: Some Announcements
While we have your attention...
Burkardt MATLAB Parallel Computing
MATLAB Parallel Computing: Some Announcements
ITHACA is an IBM iDataPlex cluster recently installed by Virginia Tech’s Advanced Research Computing facility. It is intended to gradually take over the high performance computing load from System X. ITHACA supports OpenMP, MPI and Parallel MATLAB programming. Right Now: Friendly users accepted for Ithaca (talk to John Burkardt if you are interested,); Mid October: Ithaca opened to general users (accounts given out through online application.).
Burkardt
MATLAB Parallel Computing
MATLAB Parallel Computing: Some Announcements
MATLAB Training is available this fall. These classes will be presented by the MathWorks. Some of these classes are tentative. Check the FDI website for details. 2 October: Simulink...

...INGE3016 Algorithms and Computer Programming with MATLAB
First Semester 2010-2011
COMPUTER PROJECT#1
Due on Tuesday, Spetember 13th, 2011
As this is the first program, the solution is provided. Most of the code details will be covered in class, as we progress. Therefore, at this point don’t worry if you don’t understand completely all the statements. The objective of this project is just to be able to edit, compile and run a full MATLAB program while developing the skill of writing code without syntax errors. The code must be written as a new M-file. Please note that there are two problems with two solutions each and that the solutions using array variables are more elaborated.
RUNGE-KUTTA METHOD WITH MATLAB
The Runge-Kutta method is one of the most popular methods for solving ordinary differential equations (ODEs) by means of numerical approximations. There are several version of the method depending on the desired accuracy. The simplest Runge-Kutta method is of second order, which in simpler terms means that the error is of the order of h2 ,abbreviated as O(h2).
Considering that the student has a limited background on differential equations, in this project we will attempt to solve a simple differential equation with the simplest Runge-Kutta method available. Even if the student does not have yet a formal course on differential equations, he will be able to understand the numerical solution process with his...