Upcoming SlideShare
×

# Lec1

272 views
210 views

Published on

Published in: Education, Technology
0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
Your message goes here
• Be the first to comment

• Be the first to like this

Views
Total views
272
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
4
0
Likes
0
Embeds 0
No embeds

No notes for slide

### Lec1

1. 1. MATLAB 7LEC 1- INTRODUCTION
2. 2. Command line2+3=5, try 3*2,12,2^3,2/1(d),3-2Inf,NAN try 0/1 1/0 13+inf 29/inf 0/0a=2 a=2; try a*7 chk a try a = a*7 chk aSquareroot=sqrt(4)//sin(x),sin(x*pi/180) x = i/p in radians //exp(x) try finding e and 1/edate,calendar
3. 3. Commands try to change environmentwhoswhat , why ,clc-clear command window,clear - workspaceFunctions usually return with a valuedate ,help : functions
4. 4. a,b scalarsx=0:10- vectors r generally ref as arrayssize(x) 1 row 11 columns,y=2.*x,z=y/2Try and see what happensx=0:0.1:10z=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. 5. x+2y=4,2x-y=3;Matrix approach=a=[1 2;2 -1];,b=[4;3];,x=ab;x=2,y=1Solve Function Approach=[x,y]=solve(‘x+2*y=4’,’2*x-y=3’)whos, workspace ko dekhox = double(x), y= double(y)whosFunction double converts x ( symbolic object data type to double array)
6. 6. x+2*y % =4, 2*x –y % = 3 – Flag info on rt not part of commandhelp elfun,lookfor eigenvaluemagic square=magic(10)n*n magic square has a row and column sum n(n^2 + 1)/2contour(magic(22))heights above sea level of points on maps
7. 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 flatsurfc(z) meshc(z)
8. 8. Handel’s Hallelujah chorus:load handelsound(y,Fs)train,chirp,gong,laughter,splatEarth’s view from space:load earthimage(X);colormap(map);Capital X kyun hai?????????axis imageedit whyundock,dock current directory
9. 9. M-file IntroductionC ki file likhte the turobo c me bas waisa hi hai bhiduIdhar apan log matlab ka prog m file me likhenger – plot will be red.m-script file or scriptcurrent directory test1type test1rt click,run,open,current directory folder
10. 10. How a Program works in MATLAB?Interpreter= command line = lang which computer understandsFunda 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 karegabalance = 1000no.1000 is allocated to mem location named balance in RAM
11. 11. SUMMARYMATLAB is a matrix-based computer system designed toassist in scientific an engineering problem solving.To use MATLAB, you enter commands and statements onthe command line in the Command Window. They arecarried out immediately.quit or exit terminates MATLAB.clc clears the Command Window.
12. 12. help and lookfor provide help.plot draws an x–y graph in a figure window.grid draws grid lines on a graph.
13. 13. exerciseGive values to variables a and b on thecommand line, e.g. a = 3 and b = 5. Write some statements to find the sum,difference, product and quotient of a and b.