0% found this document useful (0 votes)
31 views

Matlab 2

The document provides instructions on using fundamental MATLAB commands. It contains two tasks: 1) Understanding basic commands like sin, cos, exponents, addition, multiplication through examples. 2) Demonstrating the use of vectors, accessing elements, and performing operations on vectors like multiplication with a scalar.

Uploaded by

Sohira Qazi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

Matlab 2

The document provides instructions on using fundamental MATLAB commands. It contains two tasks: 1) Understanding basic commands like sin, cos, exponents, addition, multiplication through examples. 2) Demonstrating the use of vectors, accessing elements, and performing operations on vectors like multiplication with a scalar.

Uploaded by

Sohira Qazi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

LAB-02

OBJECTIVE:
To understand the fundamental commands of MATLAB.

TASK 01: axistext - /AXISTEXT Make axistext object


>> Theta=45*pi/180 celltext - /CELLTEXT
Theta = 0.7854 Make celltext object BioIndexedFile - class
>> a=sin(Theta) allows random read access to text files using
a = 0.7071 an index file.
>> b=cos(Theta) axestext - Wrapper object for axes text object
b = 0.7071 seltext - Text that has a 'selected' state
>> c=a^2+b^2 xregclickinput - xregtextinput Constructor for
c=1 the text control/input object.
>> a*b xregclicktolinput - xregtextinput Constructor
ans = 0.5000 for the text control/input object.
>> d=c+ans xregtextinput –
d = 1.5000 Constructor for the text control/input object.
>> A=6 A = 6 evalmcw - Evaluates a list of functions in a
>> a=3 a = 3 editable text uicontrol. imtext
>> c=A+a c = 9 Place possibly multi-line text as xlabel. ssdisp
>> X='hello' X = hello - Display text from the Slide Show format.
>> format compact textscanDemo - Reading Arbitrary Format
>> pi Text Files with TEXTSCAN xppage
ans = 3.1419 - A function for setting up a page of text.
xptext - An EXPO helper function to create
text in figure windows.
TASK 02:
getscribecontextmenu - Get the scribe
>> format loose
uicontextmenu object gtext - Place text with
>> pi
mouse.
ans = 3.1416
putdowntext –
>> format short
Plot Editor helper function scribetextdlg - Edit
>> pi
Text and Font Properties in Plot Editor
ans = 3.1416
setscribecontextmenu –
>> format long
Set the scribe uicontextmenu object text -
>> pi
Text annotation. Uicontextmenu
ans = 3.141592653589793
- Create user interface context menu.
>> format short
textwrap - Return wrapped string matrix for
e >> pi
given UI Control.
ans = 3.1416e+00
diffline - Highlights differences within a line
>> format long
of text diary - Save text of MATLAB session.
e >> pi
help - Display help text in Command Window.
ans = 3.141592653589793e+00
helpdesk –
>> format bank
Comprehensive hypertext documentation
>> pI
and troubleshooting. fprintf - Write formatted
ans = 3.14
data to text file. Fscanf
>> format hex
- Read data from text file. matfinfo - Text
>> pi
description of MAT-file contents. textread -
ans = 400921fb54442d18
Read formatted data from text file. textscan –
>> lookfor text
Read formatted data from text file or string. xregReadClipboard - Read delimited text
validatestring - Check validity of text string. from the clipboard xregReadDelimInfo –
assigninContext – Get information about delimited text file
assigns a variable in a model's global scope xregReadDelimited –
assigninroot – Read delimited text files into MBC
call assignin with the proper context xregReadDelimitedSweeps –
evalinroot - call evalin with the proper context Read delimited sweep-based text files into
aufinfo - Text description of AU file contents. MBC htmlText - Add html editing tags to
avifinfo - Text description of AVI-file contents. beginning and end of a text string.
wavfinfo – mpcCSHelp - Display MPC context sensitive
Text description of WAV file contents. help nnd - Neural Network Design Textbook
coderdemo_readfile - Read a Text File Demos. nntextbook - Neural Network Design
targets_hyperlink_manager – Textbook Information nntextdemos –
Constructs hyperlink text that calls into Neural Network Design Textbook
commmilstd188110a_print_text - Print the Demonstrations pdehelp –
output message from the ctrlcshelp – Provide PDE Toolbox help text. pm_units -
Installs GUI-wide context sensitive help. register units with physmod unit context
fasttxt2struct – plcgeneratecode –
FAST text to structure. cur2str - Bank GENERATEDFILES =
formatted text. instgetcell - Retrieve data and PLCGENERATECODE(SUBSYSTEM) Generates
context from an instrument variable. fts2ascii Structure Text for dtrsp - function y =
- writes elements of time series data into a dtrsp(sys,input,T,tfinal,x0,texthan) sdtrsp -
text (ASCII) file. function
charhelp - This file contains help text strings [v,y,u] =
for Financial Expo on line parseExtModeArgs sdtrsp(sys,K,input,h,tfinal,int,x0,z0,texthan)
- getExtModeOptions.m returns external trsp –
mode options getExtModeOptions – function y =
returns external mode options trsp(sys,input,tfinal,int,x0,texthan) mvtext -
isExtModeEnabled - getExtModeOptions.m function mvtext ltitipmenus
returns external mode options idbwtext - This - Add UIContextMenu items to datatip
function builds the INFO TEXT dialog. hdlContextMenu - Handles HDL coder context
Iduiinfo menu menus_spb_timescope –
- Manages the info-texts of the GUI objects Function to add context menus to the Time
idDisplayEstimationInfo - Update text for Scope block of DSP System addcsmenu –
estimation progress. impixelinfoval - Pixel Setup a contextmenu on an HG object
Information tool without text label. warp - addtimecsmenu –
Display image as texturemapped surface. Add a context sensitive menu to a time label.
iptcheckstrs - Check validity of text string. cshelpcontextmenu - Add a "What's This?"
ipextexturefilter – context menu.
Texture Segmentation Using Texture Filters cshelpengine - Context sensitive help engine
gtextm - Place text on map using mouse used to launch the help browser.
lcolorbar - Append colorbar with text labels fdaddcontextmenu - Add a "What's This?"
rotatetext - Rotate text to projected graticule context menu. vrtxtout –
textm – VR Text Output block Level-2 MATLAB code S-
Project text annotation on map axes spcread function tdfread - Read in text and numeric
- Read columns of data from ASCII text file data from tab-delimited file.
mbccountedtagdata – insertText - Insert text in image or video
Add textual tags to indicate coincident data stream. vipblktxtrnd - Mask helper function
points mbctagdata – for Insert Text block cwtext - Real or Complex
Add textual tags to data points xregtextlist - Continuous 1-D wavelet coefficients using
Create a series of text items in an axes txtinaxe - Right and left texts for axes.
wtxttitl - Set a text as a super title in an axes. 1.0000 1.5000 1.6667 1.7500
showparttxt – 1.8000 1.8333>>a.\b
Show partitions indices in text format.
whelpdem – >> a.^2
Utility function for displaying help text
ans =
convenient
1 9 25 49 81 121
>>2.^a
TASK 02:
>> a*3
a=5
ans =
a=
3 9 15 21 27 33
5
>> c= cos(a)
clear a c=
>> c= [0.3, 8.5, 6, -2.4] 0.5403 -0.9900 0.2837 0.7539 -
c= 0.9111 0.0044
0.3000 8.5000 6.0000 -2.4000 >> b= [5; 6; 7; 8]
>>c(3) b=
ans = 5
6
6
>>c(4) 7
ans =
8
-2.4000
>> z= 0: 1: 100
>> c= 1:6
z=
c=
Columns 1 through 14
1 2 3 4 5 6
0 1 2 3 4 5 6 7 8 9
>> b= 0: 2: 1
10 11 12 13
b= Columns 15 through 28
0 14 15 16 17 18 19 20 21 22
>> d= +3: -1: -3 23 24 25 26 27
d= Columns 29 through 42
3 2 1 0 -1 -2 -3 28 29 30 31 32 33 34 35 36
>> e= 0: pi/6: pi 37 38 39 40 41
e= Columns 43 through 56
0 0.5236 1.0472 1.5708 2.0944 42 43 44 45 46 47 48 49 50
2.6180 3.1416 51 52 53 54 55
Columns 57 through 70
>> a= [1 3 5 7 9 11]
56 57 58 59 60 61 62 63 64
a=
65 66 67 68 69
1 3 5 7 9 11
Columns 71 through 84
>> b= [1 2 3 4 5 6]
70 71 72 73 74 75 76 77 78
b= 79 80 81 82 83
1 2 3 4 5 6 Columns 85 through 98
>> a.*b 84 85 86 87 88 89 90 91 92
ans = 93 94 95 96 97
1 6 15 28 45 66 Columns 99 through 101
>> a./b 98 99 100
ans = >> size (z)
ans =
1 101
>> length (z) >> A(1,1)
ans = ans =
101 1
>> a= 1:4 >> A(3,2)
a= ans =
1 2 3 4 8
>> dot1= dot(a,b) >> size(A)
dot1 = ans =
70 3 3
>> s= sum(a) >> A(:,3)
s= ans =
9 7 9 11 3
>> c= cumsum(a) 6
c= 9
1 3 6 10 >> A(2,:)
>> p= prod(a) ans =
p= 4 5 6
24 >> B=[1 2 5;8 9 7;5 4 3]
>> d= diff(a) B=
d= 1 2 5
1 1 1 8 9 7
>> [M,i]=max(a) 5 4 3
M= >> c=[A B]
4 c=
i= 1 2 3 1 2 5
4 4 5 6 8 9 7
>> [M,i]=min(a) 7 8 9 5 4 3
M= >> size(c)
1 ans =
i= 1 1
1 >> A(1:2,1:2)
>> mean(a) ans =
ans = 1 2
2.5000 4 5
>> median(a) >> A(1:2:3,1:2:3)
ans = ans =
2.5000 1 3
>> sort(a) 7 9
ans = >> A(1:2:3,1:2)
1 2 3 4 ans =
1 2
TASK 03: 7 8
A=[1 2 3;4 5 6;7 8 9] >> A(1:2:3,:)
A=1 2 3 ans =
4 5 6 1 2 3
7 8 9 7 8 9
>> A(:)
ans =
1
4
7
2
5
8
3
6
9

Conclusion
In conclusion, learning basic MATLAB commands is
essential for using this powerful tool to solve
problems and analyze data.

You might also like