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

Matlab#2

The document contains the output of several Matlab commands. It defines a vector x from -100 to 100 in increments of 2. It displays the magic square of size 4 and calculates its determinant. It then defines vectors x, y, z, and w with different mathematical relationships and plots each in a separate subplot.

Uploaded by

Nasirahmad
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 RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

Matlab#2

The document contains the output of several Matlab commands. It defines a vector x from -100 to 100 in increments of 2. It displays the magic square of size 4 and calculates its determinant. It then defines vectors x, y, z, and w with different mathematical relationships and plots each in a separate subplot.

Uploaded by

Nasirahmad
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 RTF, PDF, TXT or read online on Scribd
You are on page 1/ 3

0

Matlab # 2

>> x=-100:2:100

x=

Columns 1 through 6

-100 -98 -96 -94 -92 -90

Columns 7 through 12

-88 -86 -84 -82 -80 -78

Columns 13 through 18

-76 -74 -72 -70 -68 -66

Columns 19 through 24

-64 -62 -60 -58 -56 -54

Columns 25 through 30

-52 -50 -48 -46 -44 -42

Columns 31 through 36

-40 -38 -36 -34 -32 -30

Columns 37 through 42

-28 -26 -24 -22 -20 -18

Columns 43 through 48

-16 -14 -12 -10 -8 -6

Columns 49 through 54

-4 -2 0 2 4 6

Columns 55 through 60

8 10 12 14 16 18

Columns 61 through 66

20 22 24 26 28 30

Columns 67 through 72
32 34 36 38 40 42

Columns 73 through 78

44 46 48 50 52 54

Columns 79 through 84

56 58 60 62 64 66

Columns 85 through 90

68 70 72 74 76 78

Columns 91 through 96

80 82 84 86 88 90

Columns 97 through 101

92 94 96 98 100

>> magic(4)

ans =

16 2 3 13
5 11 10 8
9 7 6 12
4 14 15 1

>> det(magic(4))

ans =

>> size(magic(4))

ans =

4 4
Matlab # 3

x=2:0.01:5
>> y=3*x.^2
>> subplot(2,2,4)
>> plot(x,y)

>> z=exp(x)
>> subplot(2,2,3)
>> plot(x,z)

>> w=4+5*x
>> subplot(2,2,2)
>> plot(x,w)

>> v=log(x)
>> subplot(2,2,1)
>> plot(x,v)

You might also like