0% found this document useful (0 votes)
32 views24 pages

Lab 2 Sig

1. The document provides instructions on using basic MATLAB commands like sin, cos, addition, multiplication, and formatting output. 2. Various calculations are performed on vectors and matrices, including finding maximum/minimum values, mean, median, and sorting. 3. The document also demonstrates using help and lookfor commands to search the MATLAB documentation for functions related to text.

Uploaded by

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

Lab 2 Sig

1. The document provides instructions on using basic MATLAB commands like sin, cos, addition, multiplication, and formatting output. 2. Various calculations are performed on vectors and matrices, including finding maximum/minimum values, mean, median, and sorting. 3. The document also demonstrates using help and lookfor commands to search the MATLAB documentation for functions related to text.

Uploaded by

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

Lab #02

Object :
To understand the fundamental and commands of MATLAB.

Task 01:
>> Theta=45*pi/180

Theta =

0.7854

>> a=sin(Theta)

a=

0.7071

>> b=cos(Theta)

b=

0.7071

>> c=a^2+b^2
c=

>> a*b

ans =

0.5000

>> d=c+ans

d=

1.5000

>> A=6

A=

6
>> a=3

a=

>> c=A+a

c=

>> X='hello'

X=

hello

>> format compact

>> pi

ans =

3.1416

>> format loose

>> pi
ans =

3.1416

>> format short

>> pi

ans =

3.1416

>> format long

>> pi

ans =

3.141592653589793

>> format short e

>> pi

ans =
3.1416e+00

>> format long e

>> pi

ans =

3.141592653589793e+00

>> format bank

>> pi

ans =

3.14

>> format hex

>> pi

ans =

400921fb54442d18

>> lookfor text


axistext - /AXISTEXT Make axistext object

celltext - /CELLTEXT Make celltext object

BioIndexedFile - class allows random read access to text files using an index file.

axestext - Wrapper object for axes text object

seltext - Text that has a 'selected' state

xregclickinput - xregtextinput Constructor for the text control/input object.

xregclicktolinput - xregtextinput Constructor for the text control/input object.

xregtextinput - Constructor for the text control/input object.

evalmcw - Evaluates a list of functions in a editable text uicontrol.

imtext - Place possibly multi-line text as xlabel.

ssdisp - Display text from the Slide Show format.

textscanDemo - Reading Arbitrary Format Text Files with TEXTSCAN

xppage - A function for setting up a page of text.

xptext - An EXPO helper function to create text in figure windows.

getscribecontextmenu - Get the scribe uicontextmenu object

gtext - Place text with mouse.

putdowntext - Plot Editor helper function

scribetextdlg - Edit Text and Font Properties in Plot Editor

setscribecontextmenu - Set the scribe uicontextmenu object

text - Text annotation.

uicontextmenu - Create user interface context menu.

textwrap - Return wrapped string matrix for given UI Control.

diffline - Highlights differences within a line of text

diary - Save text of MATLAB session.


help - Display help text in Command Window.

helpdesk - Comprehensive hypertext documentation and troubleshooting.

fprintf - Write formatted data to text file.

fscanf - Read data from text file.

matfinfo - Text description of MAT-file contents.

textread - Read formatted data from text file.

textscan - Read formatted data from text file or string.

validatestring - Check validity of text string.

assigninContext - assigns a variable in a model's global scope

assigninroot - call assignin with the proper context

evalinroot - call evalin with the proper context

aufinfo - Text description of AU file contents.

avifinfo - Text description of AVI-file contents.

wavfinfo - Text description of WAV file contents.

coderdemo_readfile - Read a Text File

targets_hyperlink_manager - Constructs hyperlink text that calls into

commmilstd188110a_print_text - Print the output message from the

ctrlcshelp - Installs GUI-wide context sensitive help.

fasttxt2struct - FAST text to structure.

cur2str - Bank formatted text.

instgetcell - Retrieve data and context from an instrument variable.

fts2ascii - writes elements of time series data into a text (ASCII) file.

charhelp - This file contains help text strings for Financial Expo on line

parseExtModeArgs - getExtModeOptions.m returns external mode options


getExtModeOptions - returns external mode options

isExtModeEnabled - getExtModeOptions.m returns external mode options

idbwtext - This function builds the INFO TEXT dialog.

iduiinfo - Manages the info-texts of the GUI objects

idDisplayEstimationInfo - Update text for estimation progress.

impixelinfoval - Pixel Information tool without text label.

warp - Display image as texture-mapped surface.

iptcheckstrs - Check validity of text string.

ipextexturefilter - Texture Segmentation Using Texture Filters

gtextm - Place text on map using mouse

lcolorbar - Append colorbar with text labels

rotatetext - Rotate text to projected graticule

textm - Project text annotation on map axes

spcread - Read columns of data from ASCII text file

mbccountedtagdata - Add textual tags to indicate coincident data points

mbctagdata - Add textual tags to data points

xregtextlist - Create a series of text items in an axes

xregReadClipboard - Read delimited text from the clipboard

xregReadDelimInfo - Get information about delimited text file

xregReadDelimited - Read delimited text files into MBC

xregReadDelimitedSweeps - Read delimited sweep-based text files into MBC

htmlText - Add html editing tags to beginning and end of a text string.

mpcCSHelp - Display MPC context sensitive help

nnd - Neural Network Design Textbook Demos.


nntextbook - Neural Network Design Textbook Information

nntextdemos - Neural Network Design Textbook Demonstrations

pdehelp - Provide PDE Toolbox help text.

pm_units - register units with physmod unit context

plcgeneratecode - GENERATEDFILES = PLCGENERATECODE(SUBSYSTEM) Generates


Structure Text for

dtrsp - function y = dtrsp(sys,input,T,tfinal,x0,texthan)

sdtrsp - function [v,y,u] = sdtrsp(sys,K,input,h,tfinal,int,x0,z0,texthan)

trsp - function y = trsp(sys,input,tfinal,int,x0,texthan)

mvtext - function mvtext

ltitipmenus - Add UIContextMenu items to datatip

hdlContextMenu - Handles HDL coder context menu

menus_spb_timescope - Function to add context menus to the Time Scope block of DSP
System

addcsmenu - Setup a contextmenu on an HG object

addtimecsmenu - Add a context sensitive menu to a time label.

cshelpcontextmenu - Add a "What's This?" context menu.

cshelpengine - Context sensitive help engine used to launch the help browser.

fdaddcontextmenu - Add a "What's This?" context menu.

vrtxtout - VR Text Output block Level-2 MATLAB code S-function

tdfread - Read in text and numeric data from tab-delimited file.

insertText - Insert text in image or video stream.

vipblktxtrnd - Mask helper function for Insert Text block

cwtext - Real or Complex Continuous 1-D wavelet coefficients using

txtinaxe - Right and left texts for axes.


wtxttitl - Set a text as a super title in an axes.

showparttxt - Show partitions indices in text format.

whelpdem - Utility function for displaying help text conveniently.

Task 02:
a=3

a=

>> clear a

>> c=[0.3,8.5,6,-2.4]

c=

0.3000 8.5000 6.0000 -2.4000

>> c(3)

ans =

6
>> c(4)

ans =

-2.4000

>> c=1:6

c=

1 2 3 4 5 6

>> b=0:2:1

b=

>> d=33:-1:-3

d=

Columns 1 through 12
33 32 31 30 29 28 27 26 25 24 23 22

Columns 13 through 24

21 20 19 18 17 16 15 14 13 12 11 10

Columns 25 through 36

9 8 7 6 5 4 3 2 1 0 -1 -2

Column 37

-3

>> e=0:pi/6:pi

e=

0 0.5236 1.0472 1.5708 2.0944 2.6180 3.1416

>> a=[1 3 5 7 9 11]

a=
1 3 5 7 9 11

>> b=[1 2 3 4 5 6]

b=

1 2 3 4 5 6

>> a.*b

ans =

1 6 15 28 45 66

>> a./b

ans =

1.0000 1.5000 1.6667 1.7500 1.8000 1.8333

>> a.\b

ans =
1.0000 0.6667 0.6000 0.5714 0.5556 0.5455

>> a.^b

ans =

1 9 125 2401 59049 1771561

>> 2.^a

ans =

2 8 32 128 512 2048

>> a*.3

ans =

0.3000 0.9000 1.5000 2.1000 2.7000 3.3000

>> c=cos(a)

c=
0.5403 -0.9900 0.2837 0.7539 -0.9111 0.0044

>> b=[5;6;7;8]

b=

>> z=0:1:100

z=

Columns 1 through 12

0 1 2 3 4 5 6 7 8 9 10 11

Columns 13 through 24

12 13 14 15 16 17 18 19 20 21 22 23

Columns 25 through 36
24 25 26 27 28 29 30 31 32 33 34 35

Columns 37 through 48

36 37 38 39 40 41 42 43 44 45 46 47

Columns 49 through 60

48 49 50 51 52 53 54 55 56 57 58 59

Columns 61 through 72

60 61 62 63 64 65 66 67 68 69 70 71

Columns 73 through 84

72 73 74 75 76 77 78 79 80 81 82 83

Columns 85 through 96

84 85 86 87 88 89 90 91 92 93 94 95

Columns 97 through 101


96 97 98 99 100

>> size(z)

ans =

1 101

>> length(z)

ans =

101

>> a=1:4

a=

1 2 3 4

>> dot1=dot(a,b)

dot1 =
70

>> dotz=sum(a*b)

dotz =

70

>> s=sum(0)

s=

>> c=cumsum(a)

c=

1 3 6 10

>> p=prod(a)

p=
24

>> d=diff(a)

d=

1 1 1

>> [m,i]=max(a)

m=

i=

>> [m,i]=min(a)

m=
1

i=

>> [m,i]=min(a)

m=

i=

mean(a)

ans =

2.5000

>> median(a)
ans =

2.5000

>> sort(a)

ans =

1 2 3 4

>> sort(a,'descend')

ans =

4 3 2 1

Task 03;
A=[1 2 3;4 5 6;7 8 9]

A=

1 2 3

4 5 6
7 8 9

>> A(1,1)

ans =

>> A(3,2)

ans =

>> size(A)

ans =

3 3

>> A(:,3)

ans =
3

>> A(2,:)

ans =

4 5 6

>> B=[1 2 5;8 9 7;5 4 3]

B=

1 2 5

8 9 7

5 4 3

>> c=[A B]

c=

1 2 3 1 2 5

4 5 6 8 9 7
7 8 9 5 4 3

You might also like