0% found this document useful (0 votes)
91 views3 pages

Handout 3

Uploaded by

api-247714257
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
91 views3 pages

Handout 3

Uploaded by

api-247714257
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

INSTITUTE OF BIO-MEDICAL TECHNOLOGY LIAQUAT UNIVERSITY OF MEDICAL AND HEALTH SCIENCES, JAMSHORO Subject: S !

"#$% & S'%te(% B#tc): F *%t Ye#*: +*, Te*(: -t) L#b H#",.ut / 0+

N#(e: BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB R.$$ N.: BBBBBBBBBBBBBBBBBBBB Sc.*e: BBBBBBBBBB S !"#tu*e .4 Tut.*: BBBBBBBBBBBBBB D#te:BBBBBBBBBBBBBBBB T. 1$.t !*#1)% " M#t$#b L#b Object 2e: To understand M-files principle. To plot multiple plots on a single graph. To use different parameters on the graph. To plot multiple graphs in a single graph window. Sc* 1t3M-4 $e: One can place all commands you want to execute in a file with extension 5( at the end, and you run the script file. MATLAB will run all of these commands in sequence for you. MATLAB has a M-file editor that you can use where you can create your scripts. B#% c G*#1) c C.((#",%: 6D 1$.tt "!: f x and y are arrays of elements that are the %#(e si!e, you can plot them using this data with the following command" 1$.t78, '9: E8#(1$e;0<: =$.t t)e $ "e ' > 8 =*.!*#(: #$%"%.&"&%' ($x' )lot*x,y+ Mu$t 1$e 1$.t% ." # % "!$e G*#1): f you want to plot multiple plots on a single graph, you do the following" 1$.t78<,'<,86,'6,?,8N,'N9: , is the num-er of plots you want to appear on the single graph. E8#(1$e ; 06: =$.t t)e 4.$$.@ "! - $ "e%: '< > 05<8, '6 > 05-8, '+ > 68, 'A > -8, '- > <08 =*.!*#(: x$%"%.&"&%' y&$%.&..x' y/$%.0..x' y1$/..x' y2$0..x' y0$&%..x' plot*x,y&,x,y/,x,y1,x,y2,x,y0+'

L#be$$ "! A8e%: !* , puts a grid on the graph. The spacing for the grid is automatically figured out -y MATLAB t t$e7C?D9 lets your graph ha3e a title. 8$#be$7C?D9, '$#be$7C?D9 la-els the x and y axes accordingly. )ut the la-els inside the quotations $e!e",7C?D, C?D, ?, C?D9 produces a legend, la-eling what each plot is on the graph E8#(1$e ;0+: x$%"%.&"&%' y&$%.&..x' y/$%.0..x' y1$/..x' y2$0..x' y0$&%..x' plot*x,y&,x,y/,x,y1,x,y2,x,y0+' grid' 4 To grid up the graph title*5Multiple )lots example6+' xla-el*5# points6+' yla-el*5( points6+' legend*5y&$%.&x6,6y/$%.0x6, 5y1$/x6, 5y2$0x6, 5y0$&%x6+' A,, t ."#$ 1#*#(ete*% 4.* G*#1) =$#tt "!: $ "eB%t'$e is a character string of / characters. The & st character specifies the colour of your plot. The /nd character specifies how your plot will -e plotted on the graph, or the plot style 1$.t78, ', C$ "eB%t'$eD9: 7upported colours" blue, !reen, *ed, cyan, (agenta, 'ellow, -lacE

E8#(1$e;0A: x $ %"%.&"&%' y $ x' plot*x,y,6g.6+' 4This will plot a green line with dots at each point

plot*x,y,6-o6+' 4This will plot a -lue line with circles at each point plot*x,y,8rx6+' 4This will plot a red line with crosses at each point Mu$t 1$e 1$.t% " , 44e*e"t G*#1) @ ",.@%: The 4 !u*e command can -e used to display multiple plots in separate figure windows. Mu$t 1$e G*#1)% " O"e F ",.@: Multiple plots can -e displayed within a single figure window using the su-plot function, which can -e called as follows" %ub1$.t7*.@%, c.$%, @) c)A*e#9 E8#(1$e;0-: f wanted to ma9e a window that has 2 plots, / plots in each row / rows, here6s what 6d do" :o su-plot*//&+ 7pecify that we want to wor9 on the top left corner. ,ext, code the syntax to plot normally. The plot will appear on the top left corner :o su-plot*///+ 7pecify that we want to wor9 on the top right corner. ,ext, code the syntax to plot normally. The plot will appear on the top right corner :o su-plot*//1+ 7pecify that we want to wor9 on the -ottom left corner. ,ext, code the syntax to plot normally. The plot will appear on the -ottom left corner :o su-plot*//2+ 7pecify that we want to wor9 on the -ottom right corner. ,ext, code the syntax to plot normally. The plot will appear on the -ottom right corner E8#(1$e;0G: To plot rate in the top half of a figure and growth in the -ottom half, rate$ ;1./ 2.& 0.% 0.<=' growth $ ;/.0 2.% 1.10 2.>=' figure' su-plot*/,&,&+' plot*rate+ su-plot*/,&,/+' plot*growth+ L#b T#%E%: &. )lot the following" A+ y&$/x

B+ y/$x?1

@+y1$/x?/!

/. )lot following 3ectors in a single graph and em-ellish with custom colors. Also display legend of the graph. # $ ;1 > /A=' 4 dependent 3ectors of interest ( $ ;&% B <=' C $ ;2 2 2=' t $ ;& / 1=' 4 independent 3ector 1. )lot following 2 outputs on a single graph window. Mention x-la-el, y-la-el on each. And display your Doll no" on top of the graph window. y&$/x, y/$2x, y1$<x, y2$Bx' x$ -0"%.&"0'

You might also like