2. Command line
2+3=5, try 3*2,12,2^3,2/1(d),3-2
Inf,NAN try 0/1 1/0 13+inf 29/inf 0/0
a=2 a=2; try a*7 chk a try a = a*7 chk a
Squareroot=sqrt(4)
//sin(x),sin(x*pi/180) x = i/p in radians //
exp(x) try finding e and 1/e
date,calendar
3. Commands try to change environment
whos
what , why ,
clc-clear command window,clear - workspace
Functions usually return with a value
date ,help : functions
4. a,b scalars
x=0:10- vectors r generally ref as arrays
size(x) 1 row 11 columns,y=2.*x,z=y/2
Try and see what happens
x=0:0.1:10
z=sin(x)
plot(x,z),grid
.1 ki jagah try .8 try sin(2*x)
Tan(x),ezplot(‘tan(x)’)
The TAB KEY HELP
5. x+2y=4,2x-y=3;
Matrix approach=
a=[1 2;2 -1];,b=[4;3];,x=ab;
x=2,y=1
Solve Function Approach=
[x,y]=solve(‘x+2*y=4’,’2*x-y=3’)
whos, workspace ko dekho
x = double(x), y= double(y)
whos
Function double converts x ( symbolic object
data type to double array)
6. x+2*y % =4, 2*x –y % = 3 – Flag info on rt not
part of command
help elfun,lookfor eigenvalue
magic square=magic(10)
n*n magic square has a row and column sum
n(n^2 + 1)/2
contour(magic(22))
heights above sea level of points on maps
7. Mexican hat dekhne ki koshish karte hai
[x y] = meshgrid(-8:0.5:8);
r = sqrt(x.^2 + y.^2) + eps;
z = sin(r) ./ r;
mesh(z);
surf(z), shading flat
surfc(z) meshc(z)
8. Handel’s Hallelujah chorus:
load handel
sound(y,Fs)
train,chirp,gong,laughter,splat
Earth’s view from space:
load earth
image(X);colormap(map);
Capital X kyun hai?????????
axis image
edit why
undock,dock current directory
9. M-file Introduction
C ki file likhte the turobo c me bas waisa hi hai bhidu
Idhar apan log matlab ka prog m file me likhenge
r – plot will be red
.m-script file or script
current directory test1
type test1
rt click,run,open,current directory folder
10. How a Program works in MATLAB?
Interpreter= command line = lang which computer
understands
Funda Simple hai : matlab ye ek interpreter hai!joh ap
command line pe chalate ho who ye computer ko uski
bhasha me samjha deta hai!
Iske piche ka ek aur imp funda ye hai ki matlab ek nos and
RAM ka khel khelta hai!woh particular no RAM ke
particular ek memory location me store karega
balance = 1000
no.1000 is allocated to mem location named balance in RAM
11. SUMMARY
MATLAB is a matrix-based computer system designed to
assist in scientific an engineering problem solving.
To use MATLAB, you enter commands and statements on
the command line in the Command Window. They are
carried out immediately.
quit or exit terminates MATLAB.
clc clears the Command Window.
12. help and lookfor provide help.
plot draws an x–y graph in a figure window.
grid draws grid lines on a graph.
13. exercise
Give values to variables a and b on the
command line, e.g. a = 3 and b = 5.
Write some statements to find the sum,
difference, product and quotient of a
and b.