0% found this document useful (0 votes)
15 views2 pages

Exo 3.

The document shows MATLAB code that defines arrays v1, v2, and v3 of values between 0 and 2*pi. It combines v1 and v2 into v3 and sorts the values. It also calculates the norm of v3.

Uploaded by

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

Exo 3.

The document shows MATLAB code that defines arrays v1, v2, and v3 of values between 0 and 2*pi. It combines v1 and v2 into v3 and sorts the values. It also calculates the norm of v3.

Uploaded by

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

10/03/09 19:29 MATLAB Command Window 1 of 2

>> p=2*pi

p =

6.2832

>> v1[0:0.3:p]
??? v1[0:0.3:p]
|
Error: Unbalanced or unexpected parenthesis or bracket.

>> v1=[0:0.3:p]

v1 =

Columns 1 through 15

0 0.3000 0.6000 0.9000 1.2000 1.5000 1.8000 2.1000


2.4000 2.7000 3.0000 3.3000 3.6000 3.9000 4.2000

Columns 16 through 21

4.5000 4.8000 5.1000 5.4000 5.7000 6.0000

>> pi/12

ans =

0.2618

>> 3*pi/2

ans =

4.7124

>> pas=(3*pi/2)-(pi/12)

pas =

4.4506

>> pas=pas/15

pas =

0.2967

>> v2=[(pi/12): 0.2967:(3*pi/2)]

v2 =

Columns 1 through 15

0.2618 0.5585 0.8552 1.1519 1.4486 1.7453 2.0420 2.3387


2.6354 2.9321 3.2288 3.5255 3.8222 4.1189 4.4156
10/03/09 19:29 MATLAB Command Window 2 of 2

Column 16

4.7123

>> v3=[v1,v2]

v3 =

Columns 1 through 15

0 0.3000 0.6000 0.9000 1.2000 1.5000 1.8000 2.1000


2.4000 2.7000 3.0000 3.3000 3.6000 3.9000 4.2000

Columns 16 through 30

4.5000 4.8000 5.1000 5.4000 5.7000 6.0000 0.2618 0.5585


0.8552 1.1519 1.4486 1.7453 2.0420 2.3387 2.6354

Columns 31 through 37

2.9321 3.2288 3.5255 3.8222 4.1189 4.4156 4.7123

>> sort(v3)

ans =

Columns 1 through 15

0 0.2618 0.3000 0.5585 0.6000 0.8552 0.9000 1.1519


1.2000 1.4486 1.5000 1.7453 1.8000 2.0420 2.1000

Columns 16 through 30

2.3387 2.4000 2.6354 2.7000 2.9321 3.0000 3.2288 3.3000


3.5255 3.6000 3.8222 3.9000 4.1189 4.2000 4.4156

Columns 31 through 37

4.5000 4.7123 4.8000 5.1000 5.4000 5.7000 6.0000

>> norm(v3)

ans =

19.6773

>>

You might also like