0% found this document useful (0 votes)
21 views5 pages

To Get Started, Select "MATLAB Help" From The Help Menu. 11+5 9 Whos

The document shows MATLAB code for creating and manipulating matrices and variables. It defines several matrices like m1, m2, r1, r2 and performs operations on them like transposes, element-wise multiplication, addition and exponentiation. It also defines scalar and vector variables, performs element access and plots a function. The key steps are: 1) defining matrices m1, m2, r1, r2 with numeric values; 2) performing operations like transpose, element multiplication on the matrices; 3) defining scalar and vector variables; 4) accessing elements and plotting a function of variables.
Copyright
© Attribution Non-Commercial (BY-NC)
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)
21 views5 pages

To Get Started, Select "MATLAB Help" From The Help Menu. 11+5 9 Whos

The document shows MATLAB code for creating and manipulating matrices and variables. It defines several matrices like m1, m2, r1, r2 and performs operations on them like transposes, element-wise multiplication, addition and exponentiation. It also defines scalar and vector variables, performs element access and plots a function. The key steps are: 1) defining matrices m1, m2, r1, r2 with numeric values; 2) performing operations like transpose, element multiplication on the matrices; 3) defining scalar and vector variables; 4) accessing elements and plotting a function of variables.
Copyright
© Attribution Non-Commercial (BY-NC)
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/ 5

To get started, select "MATLAB Help" from

the Help menu.


>> 11+5*9

>> whos
Name

ans =
56
>> a1=12.3
a1 =
12.3000
>> a2=14.5

Size

Bytes Class

a1

1x1

8 double array

a2

1x1

8 double array

a3

1x1

8 double array

ans

1x1

8 double array

b1

1x1

8 double array

Grand total is 5 elements using 40 bytes

a2 =

>> a1,a2,a3,b1

14.5000

a1 =

>> a3=20;

12.3000

>> b1=(a1+a2+a3)/3

a2 =

b1 =

14.5000

15.6000

a3 =

>> whos
Name

Variables created in current workspace.

20
Size

Bytes Class

a1

1x1

8 double array

a2

1x1

8 double array

a3

1x1

8 double array

ans

1x1

8 double array

b1

1x1

8 double array

Grand total is 5 elements using 40 bytes

b1 =
15.6000
>> a1=4
a1 =
4
>> b1
b1 =
15.6000
>> b1=(a1+a2+a3)/3
b1 =
12.8333

>> clear ans b1

-1

>> who

Your variables are:


a1 a2 a3

m2 =

>> clear

>> x1=sqrt(4)/4, x2=sin(pi/4)*sqrt(2),


x3=cos(exp(1)), x4=log(exp(-23.589))

2 -2

x1 =

m3 =

0.5000
x2 =

5 -10

a3 =

x3 =

1.7321

-0.9117
x4 =

2.0000
0.3333

-23.5890

-2.0000
23.0000
5.0000

>> a1=[sqrt(3) 8^(1/3) 1/3 -2 23 5],a2=[2 -8


8/3 -12 5 10]

a4 =

a1 =

5.7321 -14.0000 5.6667 -26.0000


33.0000 25.0000

1.7321 2.0000 0.3333 -2.0000 23.0000


5.0000
a2 =

>> m4=m1-m2,m5=m2*m3,m6=2*m1,
m7=m3^2
m4 =

2.0000 -8.0000 2.6667 -12.0000 5.0000


10.0000

-2 -2
-3

>> m1=[2 3;-1 4;5 2], m2=[4 5;2 -2;0 3],m3=[2


4;5 -10], a3=a1' ,a4=a1+2*a2
m1 =
2

5 -1
m5 =
33 -34

-6 28

15 -30
m6 =
4

-2

10

m7 =

>> r1=[2+3i,4-i,-8+3i;-1,2,-5+2i],
r2=[4,5;1,3;2,5];
r1 =
2.0000 + 3.0000i 4.0000 - 1.0000i -8.0000
+ 3.0000i
-1.0000
2.0000i

2.0000

24 -32

>> r3=r1' , r4=r2'

-40 120

r3 =

>> m8=m4.^3,m9=m4.*m6

2.0000 - 3.0000i -1.0000

m8 =

4.0000 + 1.0000i 2.0000

-8 -8

-8.0000 - 3.0000i -5.0000 - 2.0000i

-27 216

r4 =

125 -1

m9 =

-5.0000 +

-8 -12

>> a3(3) , a4(4) , m4(3,2) , m5(2,2)

6 48

ans =

50 -4
>> m10=2.^[3 -2 4]
m10 =
8.0000 0.2500 16.0000

0.3333
ans =
-26
ans =
-1
ans =
28
>> m4(2,:)
ans =
-3

>> m5(:,1)

m2 =

ans =

-1

33

-6

3 -9 -2

15

m3 =

>> m6(:)

ans =

8 -1 -1

4 -1

32

-2

-9

10

m4 =

8 -1 -1

4 -1

-9

>> s1=1:5 , s2=8:-2:0


s1 =
>> m1=[2 3 5 8;-1 4 8 9;5 2 32 -12;1 3 -9 -2]
m1 =

s2 =

-1

2 32 -12

3 -9 -2

>> a1=[2,3,-5;9,8,23];

>> x=[2,1,4] , y=[3,1,1,2,1]

>> [m,n]=size(a1)

x=

m=

y=
3

n=
1

>> m2=m1 (x,:) , m3=m1 (:,y) , m4=m1 (x,y)

3
>> a2=zeros(3) , a3=eye(4)

a2 =
0

a3 =

>> a4=eye(size(a1))
a4 =
1

>> a5=[a1,eye(2,4);1.1:0.3:1.7,ones(1,4)]
a5 =
2.0000 3.0000 -5.0000 1.0000
0
0
9.0000 8.0000 23.0000
0
0

0 1.0000

1.1000 1.4000 1.7000 1.0000 1.0000


1.0000 1.0000
>> x=-5:0.1:5; f=x.^3-10*x-5; plot(x,f)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy