The name MATLAB stands for MATrix LABoratory.MATLAB is a high-performance language for technical computing.
It integrates computation, visualization, and programming environment. Furthermore, MATLAB is a modern programming language environment: it has sophisticated data structures, contains built-in editing and debugging tools, and supports object-oriented programming.
These factor make MATLAB an excellent tool for teaching and research.
The name MATLAB stands for MATrix LABoratory.MATLAB is a high-performance language for technical computing.
It integrates computation, visualization, and programming environment. Furthermore, MATLAB is a modern programming language environment: it has sophisticated data structures, contains built-in editing and debugging tools, and supports object-oriented programming.
These factor make MATLAB an excellent tool for teaching and research.
1. Introduction to MATLAB and programming
2. Workspace, variables and arrays
3. Using operators, expressions and statements
4. Repeating and decision-making
5. Different methods for input and output
6. Common functions
7. Logical vectors
8. Matrices and string arrays
9. Introduction to graphics
10. Loops
11. Custom functions and M-files
How to 2D plots in Matlab. Easy steps to graph mathematical functions.
You have to define your interval of interest and consider a step in your independent vector, then you have to define your function and use an appropriate 2D built-in function.
More information and examples:
http://matrixlab-examples.com/matlab-plot-2tier.html
MATLAB DOCUMENTATION ON SOME OF THE MODULES
A.Generate videos in which a skeleton of a person doing the following Gestures.
1.Tilting his head to right and left
2.Tilting his hand to right and left
3.Walking
in matlab.
B. Write a MATLAB program that converts a decimal number to Roman number and vice versa.
C.Using EZ plot & anonymous functions plot the following:
· Y=Sqrt(X)
· Y= X^2
· Y=e^(-XY)
D.Take your picture and
· Show R, G, B channels along with RGB Image in same figure using sub figure.
· Convert into HSV( Hue, saturation and value) and show the H,S,V channels along with HSV image
E.Record your name pronounced by yourself. Try to display the signal(name) in a plot vs Time, using matlab.
F.Write a script to open a new figure and plot five circles, all centered at the origin and with increasing radii. Set the line width for each circle to something thick (at least 2 points), and use the colors from a 5-color jet colormap (jet).
G. NEWTON RAPHSON AND SECANT METHOD
H.Write any one of the program to do following things using file concept.
1.Create or Open a file
2. Read data from the file and write data to another file
3. Append some text to already existed file
4. Close the file
I.Write a function to perform following set operations
1.Union of A and B
2. Intersection of A and B
3. Complement of A and B
(Assume A= {1, 2, 3, 4, 5, 6}, B= {2, 4, 6})
This lecture we will do some practice on Basic MATLAB Scripts.
We will start with simple scripts and will discuss some electrical engineering applications.
Applications include simple electrical calculations and electrical machine models.
This is the slides of the UCLA School of Engineering Matlab workshop on Matlab graphics.
Learning Matlab graphics by examples:
- In 2 hours, you will be able to create publication-quality plots.
- Starts from the basic 2D line plots to more advanced 3D plots.
- You will also learn some advanced topics like fine-tuning the appearance of your figure and the concept of handles.
- You will be able to create amazing animations: we use 2D wave equation and Lorentz attractor as examples.
Advanced MATLAB Tutorial for Engineers & ScientistsRay Phan
This is a more advanced tutorial in the MATLAB programming environment for upper level undergraduate engineers and scientists at Ryerson University. The first half of the tutorial covers a quick review of MATLAB, which includes how to create vectors, matrices, how to plot graphs, and other useful syntax. The next part covers how to create cell arrays, logical operators, using the find command, creating Transfer Functions, finding the impulse and step response, finding roots of equations, and a few other useful tips. The last part covers more advanced concepts such as analytically calculating derivatives and integrals, polynomial regression, calculating the area under a curve, numerical solutions to differential equations, and sorting arrays.
MATLAB Programs For Beginners. | Abhi SharmaAbee Sharma
This is MATLAB's 10 most easy & most basic programs that I's supposed to submit in my practicals. In this document I've complied 10 MATLAB programs from basic to advanced through intermediate levels, But overall they are for beginners only. It's only a 26 pages doc. for academic purposes. well, What else a student can offer you, huh? LOLz
1. Introduction to MATLAB and programming
2. Workspace, variables and arrays
3. Using operators, expressions and statements
4. Repeating and decision-making
5. Different methods for input and output
6. Common functions
7. Logical vectors
8. Matrices and string arrays
9. Introduction to graphics
10. Loops
11. Custom functions and M-files
How to 2D plots in Matlab. Easy steps to graph mathematical functions.
You have to define your interval of interest and consider a step in your independent vector, then you have to define your function and use an appropriate 2D built-in function.
More information and examples:
http://matrixlab-examples.com/matlab-plot-2tier.html
MATLAB DOCUMENTATION ON SOME OF THE MODULES
A.Generate videos in which a skeleton of a person doing the following Gestures.
1.Tilting his head to right and left
2.Tilting his hand to right and left
3.Walking
in matlab.
B. Write a MATLAB program that converts a decimal number to Roman number and vice versa.
C.Using EZ plot & anonymous functions plot the following:
· Y=Sqrt(X)
· Y= X^2
· Y=e^(-XY)
D.Take your picture and
· Show R, G, B channels along with RGB Image in same figure using sub figure.
· Convert into HSV( Hue, saturation and value) and show the H,S,V channels along with HSV image
E.Record your name pronounced by yourself. Try to display the signal(name) in a plot vs Time, using matlab.
F.Write a script to open a new figure and plot five circles, all centered at the origin and with increasing radii. Set the line width for each circle to something thick (at least 2 points), and use the colors from a 5-color jet colormap (jet).
G. NEWTON RAPHSON AND SECANT METHOD
H.Write any one of the program to do following things using file concept.
1.Create or Open a file
2. Read data from the file and write data to another file
3. Append some text to already existed file
4. Close the file
I.Write a function to perform following set operations
1.Union of A and B
2. Intersection of A and B
3. Complement of A and B
(Assume A= {1, 2, 3, 4, 5, 6}, B= {2, 4, 6})
This lecture we will do some practice on Basic MATLAB Scripts.
We will start with simple scripts and will discuss some electrical engineering applications.
Applications include simple electrical calculations and electrical machine models.
This is the slides of the UCLA School of Engineering Matlab workshop on Matlab graphics.
Learning Matlab graphics by examples:
- In 2 hours, you will be able to create publication-quality plots.
- Starts from the basic 2D line plots to more advanced 3D plots.
- You will also learn some advanced topics like fine-tuning the appearance of your figure and the concept of handles.
- You will be able to create amazing animations: we use 2D wave equation and Lorentz attractor as examples.
Advanced MATLAB Tutorial for Engineers & ScientistsRay Phan
This is a more advanced tutorial in the MATLAB programming environment for upper level undergraduate engineers and scientists at Ryerson University. The first half of the tutorial covers a quick review of MATLAB, which includes how to create vectors, matrices, how to plot graphs, and other useful syntax. The next part covers how to create cell arrays, logical operators, using the find command, creating Transfer Functions, finding the impulse and step response, finding roots of equations, and a few other useful tips. The last part covers more advanced concepts such as analytically calculating derivatives and integrals, polynomial regression, calculating the area under a curve, numerical solutions to differential equations, and sorting arrays.
MATLAB Programs For Beginners. | Abhi SharmaAbee Sharma
This is MATLAB's 10 most easy & most basic programs that I's supposed to submit in my practicals. In this document I've complied 10 MATLAB programs from basic to advanced through intermediate levels, But overall they are for beginners only. It's only a 26 pages doc. for academic purposes. well, What else a student can offer you, huh? LOLz
More instructions for the lab write-up1) You are not obli.docxgilpinleeanna
More instructions for the lab write-up:
1) You are not obligated to use the 'diary' function. It was presented only for you convenience. You
should be copying and pasting your code, plots, and results into some sort of "Word" type editor that
will allow you to import graphs and such. Make sure you always include the commands to generate
what is been asked and include the outputs (from command window and plots), unless the problem
says to suppress it.
2) Edit this document: there should be no code or MATLAB commands that do not pertain to the
exercises you are presenting in your final submission. For each exercise, only the relevant code that
performs the task should be included. Do not include error messages. So once you have determined
either the command line instructions or the appropriate script file that will perform the task you are
given for the exercise, you should only include that and the associated output. Copy/paste these into
your final submission document followed by the output (including plots) that these MATLAB
instructions generate.
3) All code, output and plots for an exercise are to be grouped together. Do not put them in appendix, at
the end of the writeup, etc. In particular, put any mfiles you write BEFORE you first call them.
Each exercise, as well as the part of the exercises, is to be clearly demarked. Do not blend them all
together into some sort of composition style paper, complimentary to this: do NOT double space.
You can have spacing that makes your lab report look nice, but do not double space sections of text
as you would in a literature paper.
4) You can suppress much of the MATLAB output. If you need to create a vector, "x = 0:0.1:10" for
example, for use, there is no need to include this as output in your writeup. Just make sure you
include whatever result you are asked to show. Plots also do not have to be a full, or even half page.
They just have to be large enough that the relevant structure can be seen.
5) Before you put down any code, plots, etc. answer whatever questions that the exercise asks first.
You will follow this with the results of your work that support your answer.
SAMPLE QUESTION:
Exercise 1: Consider the function
f (x,C)=
sin(C x)
Cx
(a) Create a vector x with 100 elements from -3*pi to 3*pi. Write f as an inline or anonymous function
and generate the vectors y1 = f(x,C1), y2 = f(x,C2) and y3 = f(x,C3), where C1 = 1, C2 = 2 and
C3 = 3. Make sure you suppress the output of x and y's vectors. Plot the function f (for the three
C's above), name the axis, give a title to the plot and include a legend to identify the plots. Add a
grid to the plot.
(b) Without using inline or anonymous functions write a function+function structure m-file that does
the same job as in part (a)
SAMPLE LAB WRITEUP:
MAT 275 MATLAB LAB 1 NAME: ...
MAT-121 COLLEGE ALGEBRAWritten Assignment 32 points eac.docxjessiehampson
MAT-121: COLLEGE ALGEBRA
Written Assignment 3
2 points each except for 5, 6, 9, 15, 16, which are 4 points each as indicated.
SECTION 3.1
Algebraic
For the following exercise, determine whether the relationship represents y as a function of x. If the relationship represents a function then write the relationship as a function of
x
using
f
as the function.
x+y2=5
Consider the relationship 7n-5m=4.
Write the relationship as a function
n
=
k
(
m
).
Evaluate
k
(
5
).
Solve for
k
(
m
) = 7.
Graphical
Given the following graph
Evaluate
f
(4)
Solve for
f
(x) = 4
Numeric
For the following exercise, determine whether the relationship represents a function.
{(0, 5), (-5, 8), (0, -8)}
For the following exercise, use the function
f
represented in table below. (4 points)
x
-18
-12
-6
0
6
12
18
f(x)
24
17
10
3
-4
-11
-18
Answer the following:
Evaluate
f
(-6).
Solve
f
(
x
) = -11
Evaluate
f
(12)
Solve
f
(
x
) = -18
For the following exercise, evaluate the expressions, given functions
f
,
g
, and
h
:
f(x)=4x+2
; g(x)=7-6x; h(x)=7x2-3x+6
f(-1)g(1)h(0) (4 points)
Real-world applications
The number of cubic yards of compost,
C
, needed to cover a garden with an area of
A
square feet is given by
C
=
h
(
A
).
A garden with an area of 5,000 ft2 requires 25 yd3 of compost. Express this information in terms of the function
h
.
Explain the meaning of the statement
h
(2500) = 12.5.
SECTION 3.2
Algebraic
For the following exercise, find the domain and range of each function and state it using interval notation.
f(x)=9-2x5x+13
Numeric
For the following exercise, given each function
f
, evaluate
f
(3),
f
(-2),
f
(1), and f (0). (4 points)
Real-World Applications
The height,
h,
of a projectile is a function of the time,
t,
it is in the air. The height in meters for
t
seconds is given by the function h(t)= -9.8t2+19.6t. What is the domain of the function? What does the domain mean in the context of the problem?
SECTION 3.3
Algebraic
For the following exercise, find the average rate of change of each function on the interval specified in simplest form.
k(x)=23x+1
on [2, 2+h]
Graphical
For the following exercise, use the graph of each function to
estimate
the intervals on which the function is increasing or decreasing.
For the following exercise, find the average rate of change of each function on the interval specified.
g(x)=3x2-23x3 on [1, 3]
Real-World Applications
Near the surface of the moon, the distance that an object falls is a function of time. It is given by d(t)=1.6t2, where
t
is in seconds and d(t) is in meters. If an object is dropped from a certain height, find the average velocity of the object from t = 2 to t = 5.
SECTION 3.4
Algebraic
For the following exercise, determine the domain for each function in interval notation. (4 points)
f(x)=2x+5 and g(x)=4x+9, find f-g, f+g, fg, and fg
For.
17, r) -,r I : -l
19.t:...: 1
21.2t-31:4
/ 23. ^t: -rr - 1)t I,r r.= ll-vl
11 1
Evaluating a Function In Exercises 29-14, evaluate the
function at each specified value of the independent
variable and simplify.
29.fO-3t+t
(a) f(2) (b) /(-4) (c) f(r + 2)
30. s(y) :1 - 3y
(a) s(o) tul s(l) (c) s(s + 2)
tlzt.t(t):t2-2t
(a) h(.2) ft) /,(1.s) (c) h(x + 2)
32. v(r) - !rr3
(a) v(3) (b) Y(;) k) v(2r)
33./(.-r)::-./y
@) f(a) (u) l(0.2s) (c') [email protected])
3a.f(x)- aE+8+2
(a) f (-+) (b) /(8)
1
' x'-9
(a) q(-3) (b) q(z)
)t2+\
36. ./(r)- t'
(il qQ) 0) q(o)
lrl
37. i(r) : "'x
ar f(e) (b) /(-e)
38. -.,. : -r *4
: , -i (b) /(_5)
-, - l. x<0
'lq -, - l. .r > 0'\-
'\-
6r t(0)
', - -:. -r < 0t.
> |
1..
1OG Chapter I Functjons and Their Graphs
Testing for Functions Represented Algebraically In
Exercises 77-28. determine whether the equation
represents,r' as a function of r.
18.x:]2+1
20. y :-lf+ 5
22.r:-.y+5
24.r'l!2:3
20. lyl :1-x
28.r,:8
(c) /(x - 8)
(c) q(y + 3)
(.c) q(.- x)
(c) /(t)
(c) f(t)
(c) JQ)
,cl .f(l)
Evalr.rating a Fr.lnction In Exercises 45-48, assume that
the domain of/is the setA = {-2, - 1, 0, 1, 2}. Determine
the set of ordered pairs representing the function/.
[.rr-4. x<o42.fG)-1r_r,., r>0L1 - i.\
(il f?2) (b) /(0)
[.r- ]. t<0
I
a3.f(x)-1a. 0<r<2
L*, + t. r > 2
(a) .f(.-2) (b) /(1)
(s - ), r < otJ
44. ffrr --]s. us r < I
l.+*- r, r2 l
(a) J(. 2) (b) /(])
(c) /(1)
@ f(a)
(c) f(t)
a6. .f(.x) : x2 - 3
as. /(x) : lx + 1l
45. f(x) - x2
a7. f(x): lxl + z
Evaluating a Function In Exercises 49 and 50, complete
the tahle.
4s. h(t): llr + :l
l" - ?l50..f(r) -:
Finding the lnputs That Have Outputs of Zers In
Exercises 51-54, find all values of x such that/(r) = g'
st. 16) : 15 - 3x 52. f(x): 5r * I
3r-4
sa. f(x') - 2r-3s3. /(x) :
Finding the Dornain of a Function In Exercises 55-6J.
find the domain of the function.
,l ss. fG): 5x2 + 2x - | s6. s(ir) : 7 - 2x2
4-3v
57. hhl - ' 58. ,s( r') -I y-)
se. /(x) - 1C - 1 60. /(x) : X/" + 3x
. t 3 l0
{ el. gtrt - ' - 62. h(r) - .., 1..I f t- i LA
r'*2 -,8+6
64./(:r) :--' o f .t
t -5 -4 -3 -1
It(r)
,t 0 l2
I
2
4
/(')
63. s(.v) : 5- 10
the Domain and Range of a Function In 1)
mriffs 65-68, use a graphing utility to graph the
hhu Find the domain and range of the function.
. ,.-
-E' - \
+ i 66. f(x): 1F I 1
68. g(x) : I, - sl.j1- -r,-; : i1r + 3l
I. Geometry Write the areaA of a circle as a function of
rs --ircumference C.
il" Cmmetry Write the arca A of an equilaterai tiangle
"ts i tunction of the length s of its sides.
1!- E4loration An open box of maximum volume is to
s made from a square piece of mateial, 24 centimeters
cm a side, by cutting equal squares from the corners and
uuia-e up the sides (see figure).
,"1 , The table shows the volume 7 (in cubic centimeters)
of the box for various heights x (in centimeters).
L-se the table to estimate the maximum volume.
i Plot the points (x, I/) from the table in part (a). Does
rtre relation defined.
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docxagnesdcarey33086
SAMPLE QUESTION:
Exercise 1: Consider the function
f (x,C)=
sin(C x)
Cx
(a) Create a vector x with 100 elements from -3*pi to 3*pi. Write f as an inline or anonymous function
and generate the vectors y1 = f(x,C1), y2 = f(x,C2) and y3 = f(x,C3), where C1 = 1, C2 = 2 and
C3 = 3. Make sure you suppress the output of x and y's vectors. Plot the function f (for the three
C's above), name the axis, give a title to the plot and include a legend to identify the plots. Add a
grid to the plot.
(b) Without using inline or anonymous functions write a function+function structure m-file that does
the same job as in part (a)
SAMPLE LAB WRITEUP:
MAT 275 MATLAB LAB 1 NAME: __________________________
LAB DAY and TIME:______________
Instructor: _______________________
Exercise 1
(a)
x = linspace(-3*pi,3*pi); % generating x vector - default value for number
% of pts linspace is 100
f= @(x,C) sin(C*x)./(C*x) % C will be just a constant, no need for ".*"
C1 = 1, C2 = 2, C3 = 3 % Using commans to separate commands
y1 = f(x,C1); y2 = f(x,C2); y3 = f(x,C3); % supressing the y's
plot(x,y1,'b.-', x,y2,'ro-', x,y3,'ks-') % using different markers for
% black and white plots
xlabel('x'), ylabel('y') % labeling the axis
title('f(x,C) = sin(Cx)/(Cx)') % adding a title
legend('C = 1','C = 2','C = 3') % adding a legend
grid on
Command window output:
f =
@(x,C)sin(C*x)./(C*x)
C1 =
1
C2 =
2
C3 =
3
(b)
M-file of structure function+function
function ex1
x = linspace(-3*pi,3*pi); % generating x vector - default value for number
% of pts linspace is 100
C1 = 1, C2 = 2, C3 = 3 % Using commans to separate commands
y1 = f(x,C1); y2 = f(x,C2); y3 = f(x,C3); % function f is defined below
plot(x,y1,'b.-', x,y2,'ro-', x,y3,'ks-') % using different markers for
% black and white plots
xlabel('x'), ylabel('y') % labeling the axis
title('f(x,C) = sin(Cx)/(Cx)') % adding a title
legend('C = 1','C = 2','C = 3') % adding a legend
grid on
end
function y = f(x,C)
y = sin(C*x)./(C*x);
end
Command window output:
C1 =
1
C2 =
2
C3 =
3
Joe Bob
Mon lab: 4:30-6:50
Lab 3
Exercise 1
(a) Create function M-file for banded LU factorization
function [L,U] = luband(A,p)
% LUBAND Banded LU factorization
% Adaptation to LUFACT
% Input:
% A diagonally dominant square matrix
% Output:
% L,U unit lower triangular and upper triangular such that LU=A
n = length(A);
L = eye(n); % ones on diagonal
% Gaussian Elimination
for j = 1:n-1
a = min(j+p.
Honest Reviews of Tim Han LMA Course Program.pptxtimhan337
Personal development courses are widely available today, with each one promising life-changing outcomes. Tim Han’s Life Mastery Achievers (LMA) Course has drawn a lot of interest. In addition to offering my frank assessment of Success Insider’s LMA Course, this piece examines the course’s effects via a variety of Tim Han LMA course reviews and Success Insider comments.
Operation “Blue Star” is the only event in the history of Independent India where the state went into war with its own people. Even after about 40 years it is not clear if it was culmination of states anger over people of the region, a political game of power or start of dictatorial chapter in the democratic setup.
The people of Punjab felt alienated from main stream due to denial of their just demands during a long democratic struggle since independence. As it happen all over the word, it led to militant struggle with great loss of lives of military, police and civilian personnel. Killing of Indira Gandhi and massacre of innocent Sikhs in Delhi and other India cities was also associated with this movement.
Instructions for Submissions thorugh G- Classroom.pptxJheel Barad
This presentation provides a briefing on how to upload submissions and documents in Google Classroom. It was prepared as part of an orientation for new Sainik School in-service teacher trainees. As a training officer, my goal is to ensure that you are comfortable and proficient with this essential tool for managing assignments and fostering student engagement.
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
http://sandymillin.wordpress.com/iateflwebinar2024
Published classroom materials form the basis of syllabuses, drive teacher professional development, and have a potentially huge influence on learners, teachers and education systems. All teachers also create their own materials, whether a few sentences on a blackboard, a highly-structured fully-realised online course, or anything in between. Despite this, the knowledge and skills needed to create effective language learning materials are rarely part of teacher training, and are mostly learnt by trial and error.
Knowledge and skills frameworks, generally called competency frameworks, for ELT teachers, trainers and managers have existed for a few years now. However, until I created one for my MA dissertation, there wasn’t one drawing together what we need to know and do to be able to effectively produce language learning materials.
This webinar will introduce you to my framework, highlighting the key competencies I identified from my research. It will also show how anybody involved in language teaching (any language, not just English!), teacher training, managing schools or developing language learning materials can benefit from using the framework.
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdfTechSoup
In this webinar you will learn how your organization can access TechSoup's wide variety of product discount and donation programs. From hardware to software, we'll give you a tour of the tools available to help your nonprofit with productivity, collaboration, financial management, donor tracking, security, and more.
Acetabularia Information For Class 9 .docxvaibhavrinwa19
Acetabularia acetabulum is a single-celled green alga that in its vegetative state is morphologically differentiated into a basal rhizoid and an axially elongated stalk, which bears whorls of branching hairs. The single diploid nucleus resides in the rhizoid.
2. LET’S BEGIN……
MATLAB is a tool that simplify the programming than
any other programming language like c , c# , …….
Let’s begin with first function in MATLAB …
And the most helpful Fn .
>> help ;
this function gives you a very useful tutorial ,
and information about using MATLAB in every
applications.
1
3. FIRST TIME : HOW TO INPUT A MATRIX OR
VECTOR IN MATLAB
Vector :
>> x = [1 2 3 4]
x=1
2
3
4
o Matrix :
>> y = [1 2 3 ; 5 1 4 ; 2 3 1]
y=1
2
3
5
1
4
2
3
1
2
4. CHARACTERISTICS OF MATRIX
Transpose :
>> xt = x ’
convert the columns to rows and vice versa
x=1
2
3
4
>> x = [1 : 5]
x=1 2 3 4 5
this is the step of increment
>>x = [1 : 2 : 5]
x=1 3 5
3
5. CONTINUE……
>>size (y)
Number of columns and rows
>>length(y)
The tallest dimension(row , column) of Matrix
1
>>z = y( 2 , 2:3 )
Choose the second & third columns.
5
z=1 4
Choose the second row.
>>zeros(M ,N);
Matrix consists of zeros
>>ones(M,N);
Matrix consists of ones
>>eye(M,N) ;
The main diameter of Matrix is ones , others zeros
>>rand (M,N) ;
Uniform Distribution
>>randn (M,N);
Normally Disribution
4
6. OPERATORS
Scalar Arithmetic Operations :
>> z = x * y; multiply every element in x to its corresponding in y.
Matrices Arithmetic Operations:
>> z = x .* y ; multiply as matrices rules ,with condition (Num. of rows
of x = Num. of columns of y)
+
.+
Summation
-
.-
Subtraction
/
./
Division
^
.^
Exponential
5
7. FUNCTIONS BREAK (1):
>>sign(x) ;
If an element in matrix x is +ve returns 1 ,-ve returns
-1.
>>exp (2) The exponential function.
ans = 7.3891
round (x); Approximate the number x to the nearest number
Fix (x) ;
Delete the fraction (1.2>>1, 1.6 >>1)
Abs(complex ); Magnitude of complex number
Angle(comp.); Angle of complex number
Real(complex); Real part of complex.
isprime(x) ; 0 for not , 1 for prime number
6
8. FLOW CONTROL FUNCTIONS
For loop:
i.e.:
>>a=3;
initial value of b
>>for i = 1 :1: 10;
initial : step : final
a=a +i;
end
>> disp(a);
Fn. that display the value of a
>>sprintf (‘the number of icons is = %g ’ , a)
print the sentence ‘ ’ , replaces the %g by a
7
9. .
CONTINUE …
While loop:
i.e.:
>>b =0;
initial value of b
>>while b<4
carry out if b <4 , stop if else
b=b+1;
end
>>weight = b*2.2;
>>disp(b);
>>sprintf(‘The weight equals %f ’ , weight)
weight is float type
8
10. ..
CONTINUE …
If Statement:
i.e.:
degree =input(‘please insert the degree(0-100): ’)
fn. that make user input the value which preferred
if degree>= 85
disp(‘Excellent’)
elseif( degree>= 75 & degree <85)
disp(‘very good’)
elseif( degree>= 65 & degree <75)
disp(‘good’)
elseif( degree>= 50 & degree <65)
disp(‘pass’)
else
disp(‘fail’)
end
9
11. …
CONTINUE …
Switch …case:
i.e.:
month= input (‘please input the month(1-12): ’)
switch month
case { 1,3,5,7,8,10,12} more than one case>> {1,2,…..}
disp (31)
case{4 , 6 ,9 ,11}
disp (30)
case 2
only one case>> 1
disp (28)
end
10
12. FUNCTION BREAK(2):
>>Str = ‘ the sentence you want to write’
>>w = str [ 1 2 5 7 9]
w = thsne
x(2) = 4
change the second element value in the matrix x to 4.
X(3) = [ ]
delete the third element .
mean(x)
The mean of elements of x .
std(x)
The standard diversion of elements of x.
[theta phi r ] = cart2sph [2 , 3 , 5]
any names indicates the sph.
Conversion fn.
the values of Cartesian coordinates
11
13. GRAPHS
Line plot :
i.e.:
>>t = [ 0 : 10 ];
>> y = sin(t);
>>Figure(1)
>>plot (t,y)
>>xlabel(‘time’)
>>ylabel(‘input’)
>>title (‘Gain’)
y is sinusoidal wave on t
Open figure , name it 1
plot t(h-axis) versus y (v-axis) in figure.
write 9time) under h-axis
write (input) beside v-axis
Make a title for plot
12
14. .
CONTINUE …
Bar Graph:
i.e.:
>>x = -3 : 1 : 3;
>>y = x.^2;
>>bar(x,y)
Bar Graph
>>figure(1)
>>subplot 221
divide the figure into number of plots
>>z= magic (3);
special function
>>subplot 222
row no. column no. position
>>bar(z)
>>subplot (2,2,3)
>> bar(z , ‘grouped’) Style type
>>subplot(2,2,4)
>>bar (z , ‘stacked’)
13
15. ..
CONTINUE …
Histogram :
>> hist (z , 7 )
Number of intervals in histogram
Pie Graph :
>>z = [10 4 5 8 2];
>>pie(z)
Polar Graph :
>>polar(t , y)
14
16. …
CONTINUE …
Scatter plot :
>>x =[1:10];
>> y = 2.*rand (1,10)
>>subplot 221
>>scatter(x ,y)
scatter points on plot
>>subplot 222
>> stem ( x , y)
scatter points connected with the h-axis
>>subplot 223
>>scatter(x ,y , 3 , ‘y’ ) Mark color (yellow)
size of mark (scatter point)
15
18. FUNCTION BREAK(3)
>>log (x)
>>log10(x)
>>log2 (x)
>>semilogy(x,y)
>>semilogx(x,y)
>>loglog(x,y)
>>barh(z)
>>break;
>>continue;
>>surf(x,y,z)
>>contour(x,y,z)
Ln Function
Log. Decimal Function
Log. Binary Function
convert v-axis to dB
convert h-axis to dB
convert two axes to dB
Opposite of Bar graph
stop loop and move to the next command
stop the itertion and move to the other itertion on loop
Graph the surface and put the points on it
17
19. SYMBOLIC MATH :
Functions:
>>syms x y z ;
convert this variables into symbols
>>f = x^2 + y^2 +z^2;
Substitution
the symbols you want substitute
>>f1 = subs( f , [x y] , [4 5] )
the values of substitution
f1 = 16 + 25+z^2
Differentiation
>>f2 = diff ( f , 2 , z )
The symbol you want to diff.
f2 = 2
The order of diff.
Integration
>>f3 = int (f1 , -10 , 10 )
Final limit
f3 = 5
initial limit
Limit Fn
>>limit ( sin (x) /x , inf )
the value the limit approximate to
Summation
>>symsum( 1 / x^2 , 1 , inf )
the final sub . of summation
the initial sub. of summation
18
20. DOMAINS TRANSFORMS :
Laplace Transform :
>>syms t ;
>> laplace ( cos (t))
laplace transform
Ans = s / (s^2 +1)
>>ilaplace (s/ (s^2 +1)
inverse laplace transform
Ans = cos t
>>transferfn = tf ([1] , [1 2 1]) transfer fn.
Transfer function = 1 / s^2 + 2* s + 1
>> bode(transferfn)
Bode plot
>> step(transferfn)
Step response
>> impulse (transferfn)
Impulse response
19
21. .
CONTINUE …
Fourier Transform :
>>syms t w b ;
>>y = cos(b*t);
>> f = fourier (x , t ,w );
>>y = cos( 2*pi *t);
>>fd = fft ( y , 512 );
must be 2^n
20