Вы находитесь на странице: 1из 44

1.-definir un vector fila a de 100 elementos , con paso de 0.

5 y elemento inicial
3.5.definir un vector columna b de 100 elementos , con un paso de 2 y elemento inicial
6.>> a=3.5:0.5:53
a=
Columns 1 through 7
3.5000 4.0000 4.5000 5.0000 5.5000 6.0000 6.5000
Columns 8 through 14
7.0000 7.5000 8.0000 8.5000 9.0000 9.5000 10.0000
Columns 15 through 21
10.5000 11.0000 11.5000 12.0000 12.5000 13.0000 13.5000
Columns 22 through 28
14.0000 14.5000 15.0000 15.5000 16.0000 16.5000 17.0000
Columns 29 through 35
17.5000 18.0000 18.5000 19.0000 19.5000 20.0000 20.5000
Columns 36 through 42
21.0000 21.5000 22.0000 22.5000 23.0000 23.5000 24.0000
Columns 43 through 49
24.5000 25.0000 25.5000 26.0000 26.5000 27.0000 27.5000
Columns 50 through 56
28.0000 28.5000 29.0000 29.5000 30.0000 30.5000 31.0000
Columns 57 through 63
31.5000 32.0000 32.5000 33.0000 33.5000 34.0000 34.5000
Columns 64 through 70
35.0000 35.5000 36.0000 36.5000 37.0000 37.5000 38.0000
Columns 71 through 77
38.5000 39.0000 39.5000 40.0000 40.5000 41.0000 41.5000
Columns 78 through 84
42.0000 42.5000 43.0000 43.5000 44.0000 44.5000 45.0000
Columns 85 through 91
45.5000 46.0000 46.5000 47.0000 47.5000 48.0000 48.5000
Columns 92 through 98
49.0000 49.5000 50.0000 50.5000 51.0000 51.5000 52.0000
Columns 99 through 100
52.5000 53.0000
>> B=6:2:206
B=
Columns 1 through 11
6 8 10 12 14 16
Columns 12 through 22
28 30 32 34 36 38
Columns 23 through 33
50 52 54 56 58 60
Columns 34 through 44
72 74 76 78 80 82

18 20 22 24 26
40 42 44 46 48
62 64 66 68 70
84 86 88 90 92

Columns 45 through 55
94 96 98 100 102 104 106 108 110 112 114
Columns 56 through 66
116 118 120 122 124 126 128 130 132 134 136
Columns 67 through 77
138 140 142 144 146 148 150 152 154 156 158
Columns 78 through 88
160 162 164 166 168 170 172 174 176 178 180
Columns 89 through 99
182 184 186 188 190 192 194 196 198 200 202
Columns 100
204
A) defina una variable que contenga el elemento 43 del vector del vector a y otra que
contenga el elemento 77 del vector b.
>> w=a(43)
w = 24.5000

>> g=B(77)
g=
158

B)elevar al cuadrado cada uno de los elementos del vector a:


>> a. ^2
ans =
Columns 1 through 7
0.0123 0.0160 0.0203 0.0250 0.0302 0.0360 0.0423
Columns 8 through 14
0.0490 0.0563 0.0640 0.0722 0.0810 0.0902 0.1000
Columns 15 through 21
0.1103 0.1210 0.1323 0.1440 0.1563 0.1690 0.1823
Columns 22 through 28
0.1960 0.2102 0.2250 0.2402 0.2560 0.2722 0.2890
Columns 29 through 35
0.3063 0.3240 0.3423 0.3610 0.3802 0.4000 0.4203
Columns 36 through 42
0.4410 0.4622 0.4840 0.5062 0.5290 0.5523 0.5760
Columns 43 through 49
0.6002 0.6250 0.6502 0.6760 0.7023 0.7290 0.7562
Columns 50 through 56
0.7840 0.8123 0.8410 0.8702 0.9000 0.9303 0.9610
Columns 57 through 63
0.9922 1.0240 1.0562 1.0890 1.1223 1.1560 1.1903
Columns 64 through 70
1.2250 1.2603 1.2960 1.3322 1.3690 1.4063 1.4440
Columns 71 through 77

1.4823 1.5210 1.5602


Columns 78 through 84
1.7640 1.8062 1.8490
Columns 85 through 91
2.0703 2.1160 2.1622
Columns 92 through 98
2.4010 2.4503 2.5000
Columns 99 through 100
2.7563 2.8090

1.6000 1.6403 1.6810 1.7223


1.8923 1.9360 1.9803 2.0250
2.2090 2.2563 2.3040 2.3523
2.5503 2.6010 2.6523 2.7040

c) realizar las siguientes operaciones con los vectores ayb :suma ,resta multiplicacin y
divisin (elemento a elemento).
>> a+B
ans =
Columns 1 through 7
9.5000 12.0000 14.5000 17.0000 19.5000 22.0000 24.5000
Columns 8 through 14
27.0000 29.5000 32.0000 34.5000 37.0000 39.5000 42.0000
Columns 15 through 21
44.5000 47.0000 49.5000 52.0000 54.5000 57.0000 59.5000
Columns 22 through 28
62.0000 64.5000 67.0000 69.5000 72.0000 74.5000 77.0000
Columns 29 through 35
79.5000 82.0000 84.5000 87.0000 89.5000 92.0000 94.5000
Columns 36 through 42
97.0000 99.5000 102.0000 104.5000 107.0000 109.5000 112.0000
Columns 43 through 49
114.5000 117.0000 119.5000 122.0000 124.5000 127.0000 129.5000
Columns 50 through 56
132.0000 134.5000 137.0000 139.5000 142.0000 144.5000 147.0000
Columns 57 through 63
149.5000 152.0000 154.5000 157.0000 159.5000 162.0000 164.5000
Columns 64 through 70
167.0000 169.5000 172.0000 174.5000 177.0000 179.5000 182.0000
Columns 71 through 77
184.5000 187.0000 189.5000 192.0000 194.5000 197.0000 199.5000
Columns 78 through 84
202.0000 204.5000 207.0000 209.5000 212.0000 214.5000 217.0000
Columns 85 through 91
219.5000 222.0000 224.5000 227.0000 229.5000 232.0000 234.5000
Columns 92 through 98
237.0000 239.5000 242.0000 244.5000 247.0000 249.5000 252.0000
Columns 99 through 100 254.5000 257.0000

>> a-B
ans =

Columns 1 through 7
-2.5000 -4.0000 -5.5000 -7.0000 -8.5000 -10.0000 -11.5000
Columns 8 through 14
-13.0000 -14.5000 -16.0000 -17.5000 -19.0000 -20.5000 -22.0000
Columns 15 through 21
-23.5000 -25.0000 -26.5000 -28.0000 -29.5000 -31.0000 -32.5000
Columns 22 through 28
-34.0000 -35.5000 -37.0000 -38.5000 -40.0000 -41.5000 -43.0000
Columns 29 through 35
-44.5000 -46.0000 -47.5000 -49.0000 -50.5000 -52.0000 -53.5000
Columns 36 through 42
-55.0000 -56.5000 -58.0000 -59.5000 -61.0000 -62.5000 -64.0000
Columns 43 through 49
-65.5000 -67.0000 -68.5000 -70.0000 -71.5000 -73.0000 -74.5000
Columns 50 through 56
-76.0000 -77.5000 -79.0000 -80.5000 -82.0000 -83.5000 -85.0000
Columns 57 through 63
-86.5000 -88.0000 -89.5000 -91.0000 -92.5000 -94.0000 -95.5000
Columns 64 through 70
-97.0000 -98.5000 -100.0000 -101.5000 -103.0000 -104.5000 -106.0000
Columns 71 through 77
-107.5000 -109.0000 -110.5000 -112.0000 -113.5000 -115.0000 -116.5000
Columns 78 through 84
-118.0000 -119.5000 -121.0000 -122.5000 -124.0000 -125.5000 -127.0000
Columns 85 through 91
-128.5000 -130.0000 -131.5000 -133.0000 -134.5000 -136.0000 -137.5000
Columns 92 through 98
-139.0000 -140.5000 -142.0000 -143.5000 -145.0000 -146.5000 -148.0000
Columns 99 through 100
-149.5000 -151.0000
>> a.*B
ans =
Columns 1 through 5
21
32
45
Columns 6 through 10
96
117
140
Columns 11 through 15
221
252
285
Columns 16 through 20
396
437
480
Columns 21 through 25

60

77

165

192

320

357

525

572

621
672
725
Columns 26 through 30
896
957
1020
Columns 31 through 35
1221
1292
1365
Columns 36 through 40
1596
1677
1760
Columns 41 through 45
2021
2112
2205
Columns 46 through 50
2496
2597
2700
Columns 51 through 55
3021
3132
3245
Columns 56 through 60
3596
3717
3840
Columns 61 through 65
4221
4352
4485
Columns 66 through 70
4896
5037
5180
Columns 71 through 75
5621
5772
5925
Columns 76 through 80
6396
6557
6720
Columns 81 through 85
7221
7392
7565
Columns 86 through 90
8096
8277
8460
Columns 91 through 95
9021
9212
9405
Columns 96 through 100
9996
10197
10400

780
1085

837
1152

1440

1517

1845

1932

2300

2397

2805

2912

3360

3477

3965

4092

4620

4757

5325

5472

6080

6237

6885

7052

7740

7917

8645

8832

9600

9797

10605

10812

>> a./B
ans =
Columns 1 through 7
0.5833 0.5000 0.4500 0.4167 0.3929 0.3750 0.3611
Columns 8 through 14
0.3500 0.3409 0.3333 0.3269 0.3214 0.3167 0.3125
Columns 15 through 21
0.3088 0.3056 0.3026 0.3000 0.2976 0.2955 0.2935

Columns 22 through 28
0.2917 0.2900 0.2885 0.2870 0.2857
Columns 29 through 35
0.2823 0.2813 0.2803 0.2794 0.2786
Columns 36 through 42
0.2763 0.2756 0.2750 0.2744 0.2738
Columns 43 through 49
0.2722 0.2717 0.2713 0.2708 0.2704
Columns 50 through 56
0.2692 0.2689 0.2685 0.2682 0.2679
Columns 57 through 63
0.2669 0.2667 0.2664 0.2661 0.2659
Columns 64 through 70
0.2652 0.2649 0.2647 0.2645 0.2643
Columns 71 through 77
0.2637 0.2635 0.2633 0.2632 0.2630
Columns 78 through 84
0.2625 0.2623 0.2622 0.2620 0.2619
Columns 85 through 91
0.2615 0.2614 0.2612 0.2611 0.2610
Columns 92 through 98
0.2606 0.2605 0.2604 0.2603 0.2602
Columns 99 through 100 0.2599 0.2598

0.2845 0.2833
0.2778 0.2770
0.2733 0.2727
0.2700 0.2696
0.2675 0.2672
0.2656 0.2654
0.2641 0.2639
0.2628 0.2627
0.2618 0.2616
0.2609 0.2608
0.2601 0.2600

d) calcular el logaritmo, la raz cuadrada, y la exponencial de cada uno de los


elementos del vector b :
>> log(B)
ans =
Columns 1 through 7
1.7918 2.0794 2.3026 2.4849 2.6391 2.7726 2.8904
Columns 8 through 14
2.9957 3.0910 3.1781 3.2581 3.3322 3.4012 3.4657
Columns 15 through 21
3.5264 3.5835 3.6376 3.6889 3.7377 3.7842 3.8286
Columns 22 through 28
3.8712 3.9120 3.9512 3.9890 4.0254 4.0604 4.0943
Columns 29 through 35
4.1271 4.1589 4.1897 4.2195 4.2485 4.2767 4.3041
Columns 36 through 42
4.3307 4.3567 4.3820 4.4067 4.4308 4.4543 4.4773
Columns 43 through 49

4.4998 4.5218 4.5433 4.5643 4.5850 4.6052 4.6250


Columns 50 through 56
4.6444 4.6634 4.6821 4.7005 4.7185 4.7362 4.7536
Columns 57 through 63
4.7707 4.7875 4.8040 4.8203 4.8363 4.8520 4.8675
Columns 64 through 70
4.8828 4.8978 4.9127 4.9273 4.9416 4.9558 4.9698
Columns 71 through 77
4.9836 4.9972 5.0106 5.0239 5.0370 5.0499 5.0626
Columns 78 through 84
5.0752 5.0876 5.0999 5.1120 5.1240 5.1358 5.1475
Columns 85 through 91
5.1591 5.1705 5.1818 5.1930 5.2040 5.2149 5.2257
Columns 92 through 98
5.2364 5.2470 5.2575 5.2679 5.2781 5.2883 5.2983
Columns 99 through 100
5.3083 5.3181
Raz cuadrada de b :
>> sqrt(B)
ans =
Columns 1 through 7
2.4495 2.8284 3.1623 3.4641 3.7417 4.0000 4.2426
Columns 8 through 14
4.4721 4.6904 4.8990 5.0990 5.2915 5.4772 5.6569
Columns 15 through 21
5.8310 6.0000 6.1644 6.3246 6.4807 6.6332 6.7823
Columns 22 through 28
6.9282 7.0711 7.2111 7.3485 7.4833 7.6158 7.7460
Columns 29 through 35
7.8740 8.0000 8.1240 8.2462 8.3666 8.4853 8.6023
Columns 36 through 42
8.7178 8.8318 8.9443 9.0554 9.1652 9.2736 9.3808
Columns 43 through 49
9.4868 9.5917 9.6954 9.7980 9.8995 10.0000 10.0995
Columns 50 through 56
10.1980 10.2956 10.3923 10.4881 10.5830 10.6771 10.7703
Columns 57 through 63
10.8628 10.9545 11.0454 11.1355 11.2250 11.3137 11.4018
Columns 64 through 70
11.4891 11.5758 11.6619 11.7473 11.8322 11.9164 12.0000
Columns 71 through 77

12.0830 12.1655 12.2474


Columns 78 through 84
12.6491 12.7279 12.8062
Columns 85 through 91
13.1909 13.2665 13.3417
Columns 92 through 98
13.7113 13.7840 13.8564
Columns 99 through 100
14.2127 14.2829
>> exp(B)
ans =
1.0e+088 *
Columns 1 through 7
0.0000 0.0000 0.0000
Columns 8 through 14
0.0000 0.0000 0.0000
Columns 15 through 21
0.0000 0.0000 0.0000
Columns 22 through 28
0.0000 0.0000 0.0000
Columns 29 through 35
0.0000 0.0000 0.0000
Columns 36 through 42
0.0000 0.0000 0.0000
Columns 43 through 49
0.0000 0.0000 0.0000
Columns 50 through 56
0.0000 0.0000 0.0000
Columns 57 through 63
0.0000 0.0000 0.0000
Columns 64 through 70
0.0000 0.0000 0.0000
Columns 71 through 77
0.0000 0.0000 0.0000
Columns 78 through 84
0.0000 0.0000 0.0000
Columns 85 through 91
0.0000 0.0000 0.0000
Columns 92 through 98
0.0000 0.0000 0.0000

12.3288 12.4097 12.4900 12.5698


12.8841 12.9615 13.0384 13.1149
13.4164 13.4907 13.5647 13.6382
13.9284 14.0000 14.0712 14.1421

0.0000 0.0000 0.0000 0.0000


0.0000 0.0000 0.0000 0.0000
0.0000 0.0000 0.0000 0.0000
0.0000 0.0000 0.0000 0.0000
0.0000 0.0000 0.0000 0.0000
0.0000 0.0000 0.0000 0.0000
0.0000 0.0000 0.0000 0.0000
0.0000 0.0000 0.0000 0.0000
0.0000 0.0000 0.0000 0.0000
0.0000 0.0000 0.0000 0.0000
0.0000 0.0000 0.0000 0.0000
0.0000 0.0000 0.0000 0.0000
0.0000 0.0000 0.0000 0.0000
0.0002 0.0013 0.0098 0.0723

Columns 99 through 100


0.5339 3.9452
2) crear un vector v cuyo primer elemento sea 55 y el ultimo 480, tal que la diferencia
entre dos elementos sea 5.
>> v=55:5:480
v=
Columns 1 through 11
55 60 65 70 75 80 85
Columns 12 through 22
110 115 120 125 130 135
Columns 23 through 33
165 170 175 180 185 190
Columns 34 through 44
220 225 230 235 240 245
Columns 45 through 55
275 280 285 290 295 300
Columns 56 through 66
330 335 340 345 350 355
Columns 67 through 77
385 390 395 400 405 410
Columns 78 through 86
440 445 450 455 460 465

90 95 100 105
140 145 150 155 160
195 200 205 210 215
250 255 260 265 270
305 310 315 320 325
360 365 370 375 380
415 420 425 430 435
470 475 480

A) definir una variable, n que contenga el numero de elementos definidos en el vector


v:
>> n=length(v)
n = 86
B) definr un vector u que contenga la raz cubica de los elementos del vector v :
>> u=sqrt(v)
u=
Columns 1 through 7
7.4162 7.7460 8.0623 8.3666 8.6603 8.9443 9.2195
Columns 8 through 14
9.4868 9.7468 10.0000 10.2470 10.4881 10.7238 10.9545
Columns 15 through 21
11.1803 11.4018 11.6190 11.8322 12.0416 12.2474 12.4499
Columns 22 through 28
12.6491 12.8452 13.0384 13.2288 13.4164 13.6015 13.7840
Columns 29 through 35
13.9642 14.1421 14.3178 14.4914 14.6629 14.8324 15.0000

Columns 36 through 42
15.1658 15.3297 15.4919
Columns 43 through 49
16.2788 16.4317 16.5831
Columns 50 through 56
17.3205 17.4642 17.6068
Columns 57 through 63
18.3030 18.4391 18.5742
Columns 64 through 70
19.2354 19.3649 19.4936
Columns 71 through 77
20.1246 20.2485 20.3715
Columns 78 through 84
20.9762 21.0950 21.2132
Columns 85 through 86
21.7945 21.9089

15.6525 15.8114 15.9687 16.1245


16.7332 16.8819 17.0294 17.1756
17.7482 17.8885 18.0278 18.1659
18.7083 18.8414 18.9737 19.1050
19.6214 19.7484 19.8746 20.0000
20.4939 20.6155 20.7364 20.8567
21.3307 21.4476 21.5639 21.6795

c) transponer los vectores u y v :


>> v'
ans =
55
60
65
70
75
80
85
90
95
100
105
110
115
120
125
130
135
140
145
150
155
160
165

170
175
180
185
190
195
200
205
210
215
220
225
230
235
240
245
250
255
260
265
270
275
280

285
290
295
300
305
310
315
320
325
330
335
340
345
350
355
360
365
370
375
380
385
390
395

400
405
410
415
420
425
430
435
440
445
450
455
460
465
470
475
480

>> u'
ans =
7.4162
7.7460
8.0623
8.3666
8.6603
8.9443
9.2195
9.4868
9.7468
10.0000
10.2470
10.4881
10.7238
10.9545
11.1803
11.4018
11.6190
11.8322
12.0416
12.2474
12.4499
12.6491
12.8452
13.0384
13.2288
13.4164
13.6015
13.7840
13.9642
14.1421
14.3178
14.4914
14.6629
14.8324
15.0000
15.1658
15.3297
15.4919
15.6525
15.8114
15.9687
16.1245
16.2788

16.4317
16.5831
16.7332
16.8819
17.0294
17.1756
17.3205
17.4642
17.6068
17.7482
17.8885
18.0278
18.1659
18.3030
18.4391
18.5742
18.7083
18.8414
18.9737
19.1050
19.2354
19.3649
19.4936
19.6214
19.7484
19.8746
20.0000
20.1246
20.2485
20.3715
20.4939
20.6155
20.7364
20.8567
20.9762
21.0950
21.2132
21.3307
21.4476
21.5639
21.6795
21.7945
21.9089

Definir los siguientes vectores tales que: q=n*v ,s=v*u y t=u/v.


>> q=n*v
q=
Columns 1 through 5
4730
5160
5590
6020
6450
Columns 6 through 10
6880
7310
7740
8170
8600
Columns 11 through 15
9030
9460
9890
10320
10750
Columns 16 through 20
11180
11610
12040
12470
12900
Columns 21 through 25
13330
13760
14190
14620
15050
Columns 26 through 30
15480
15910
16340
16770
17200
Columns 31 through 35
17630
18060
18490
18920
19350
Columns 36 through 40
19780
20210
20640
21070
21500
Columns 41 through 45
21930
22360
22790
23220
23650
Columns 46 through 50
24080
24510
24940
25370
25800
Columns 51 through 55
26230
26660
27090
27520
27950
Columns 56 through 60
28380
28810
29240
29670
30100
Columns 61 through 65
30530
30960
31390
31820
32250
Columns 66 through 70
32680
33110
33540
33970
34400
Columns 71 through 75
34830
35260
35690
36120
36550
Columns 76 through 80
36980
37410
37840
38270
38700
Columns 81 through 85
39130
39560
39990
40420
40850
Column 86
41280
>> S=v*u
??? Error using ==> mtimes
Inner matrix dimensions must agree.
>> t=u/v
t=
0.0545
>> t=u./v
t=

Columns 1 through 7
0.1348 0.1291 0.1240
Columns 8 through 14
0.1054 0.1026 0.1000
Columns 15 through 21
0.0894 0.0877 0.0861
Columns 22 through 28
0.0791 0.0778 0.0767
Columns 29 through 35
0.0716 0.0707 0.0698
Columns 36 through 42
0.0659 0.0652 0.0645
Columns 43 through 49
0.0614 0.0609 0.0603
Columns 50 through 56
0.0577 0.0573 0.0568
Columns 57 through 63
0.0546 0.0542 0.0538
Columns 64 through 70
0.0520 0.0516 0.0513
Columns 71 through 77
0.0497 0.0494 0.0491
Columns 78 through 84
0.0477 0.0474 0.0471
Columns 85 through 86
0.0459 0.0456

0.1195 0.1155 0.1118 0.1085


0.0976 0.0953 0.0933 0.0913
0.0845 0.0830 0.0816 0.0803
0.0756 0.0745 0.0735 0.0725
0.0690 0.0682 0.0674 0.0667
0.0639 0.0632 0.0626 0.0620
0.0598 0.0592 0.0587 0.0582
0.0563 0.0559 0.0555 0.0550
0.0535 0.0531 0.0527 0.0523
0.0510 0.0506 0.0503 0.0500
0.0488 0.0485 0.0482 0.0479
0.0469 0.0466 0.0464 0.0461

c) definir una variable que contenga la suma de los elementos del vector q, el mximo del
vector t y el mnimo del vector s.
>> s = suma_vec (q)
s=
1978430
>> max(t)
ans =
0.1348
Definir una variable que sea el producto escalar de los vectores u y v.
>> x=u.*v

Columns 1 through 7
0.0408 0.0465 0.0524
Columns 8 through 14
0.0854 0.0926 0.1000
Columns 15 through 21
0.1398 0.1482 0.1569
Columns 22 through 28
0.2024 0.2119 0.2217
Columns 29 through 35
0.2723 0.2828 0.2935
Columns 36 through 42
0.3488 0.3602 0.3718
Columns 43 through 49
0.4314 0.4437 0.4560
Columns 50 through 56
0.5196 0.5327 0.5458
Columns 57 through 63
0.6132 0.6269 0.6408
Columns 64 through 70
0.7117 0.7262 0.7408
Columns 71 through 77
0.8150 0.8302 0.8454
Columns 78 through 84
0.9230 0.9387 0.9546
Columns 85 through 86
1.0352 1.0516

0.0586 0.0650 0.0716 0.0784


0.1076 0.1154 0.1233 0.1315
0.1657 0.1746 0.1837 0.1930
0.2315 0.2415 0.2516 0.2619
0.3043 0.3153 0.3263 0.3375
0.3835 0.3953 0.4072 0.4192
0.4685 0.4811 0.4939 0.5067
0.5591 0.5724 0.5859 0.5995
0.6548 0.6689 0.6831 0.6973
0.7554 0.7702 0.7850 0.8000
0.8607 0.8762 0.8917 0.9073
0.9705 0.9866 1.0027 1.0189

g) definir una variable que contenga los 3 primeros elementos del vector u y otra que contenga
los ltimos 3 del vector v. calcular el producto vectorial de ambas variables.
j = 7.4162 7.7460 8.0623

ll = 470 475 480


>> cross(j,ll)
para calcular el producto vectorial.
Ans =
-111.5125 229.5050 -117.9250
3)dados los vectores desplazamientos a=(3.0i-4.0j+4.0k)m y b=(2.0i+3.0j-7.0k)m.
a) encuentre las magnitudes de los vectores.
>> a=[3 -4 4]
>> b=[2 3 -7]
a=
3 -4

b=
2

3 -7

Con el comando : norm(variable del vector, 2)


>> norm(a,2)
Ans =
6.4031

>> norm(b,2)
Ans =
7.8740

b) C=A+B
>> C=a+b
C=
5 -1 -3
c) D=2A-B
>> D=(a.*2)-b
D=
4 -11 15
4) sean los vectores filas u y w definidos de la siguiente forma .u=[10,-11,12] w=[2,1,3]

a)halle el producto escalar entre u y w, y el producto elemento a elemento entre u y w.


>> u*w'
Ans = 45

>> u.*w
ans = 20 -11 36

b) la norma euclidiana de un vector v se define como ||v||=raz


Calcule la norma de dos maneras, existe una funcin predeterminada en el matlab para
determinar la norma de un vector? si, con el comando NORM .
>> Norm (u,2)
Ans =
19.1050
c) el Angulo entre los vectores u y w.
>> cosx=(u.*w)/(h*y)
cosx =
0.2798 -0.1539 0.5036
>> acos(0.5963)
ans =
53.3963 grados

5) dados los vectores a=[-3,4] y b=[2,3] encuentre:


a) A.B Y AXB
>> a*b'
Ans =
6

>> a.*b
Ans =
-6 12

b) evale las cantidades arcos y arcsen


>> acos(0.7442)
Ans =
41.9095
c) Cul de ellas da el ngulo entre los dos vectores?
La funcin arco seno.
6) dadas las siguientes matrices:
A=[3,0,-2;1,4,5;-1,1,2]
B=[1,-1,1;0,6,1;3,-2,-5]
C=[-1,-1,2;5,1,1;-3,-2,3]
a) A+B-C
>> A+B-C
ans =
5 0 -3
-4 9 5
5 1 -6
b) a*b
>> A*B
ans =
-3 1 13
16 13 -20
5 3 -10
C) C^2
>> C.^2
ans =
1 1 4
25 1 1
9 4 9
D) elevar cada uno de los elementos de la matriz c al cubo
>> C.^3
ans =
-1 -1 8
125 1 1
-27 -8 27

e) calcular el inverso de A.
>> inv(A)
ans =
-3.0000 2.0000 -8.0000
7.0000 -4.0000 17.0000
-5.0000 3.0000 -12.0000
f) calcular el determinante de B
>> det(B)
ans =
-49.0000
g) definir una nueva matriz D tal que dij=aij*bij
>> A*B
ans =
-3 1 13
16 13 -20
5 3 -10
>> ij=[1,1,1;1,1,1;1,1,1]
ij =
1
1
1

1
1
1

1
1
1

>> D= ij*(A*B)
ans =
18 17 -17
18 17 -17
18 17 -17
7) construya 3 vectores columna, de modo que la diferencia entre dos elementos consecutivos
sea 0.4 para el primero, 0.6 para el segundo y 2 para el tercero.
x=
0
0.4000
0.8000
1.2000
1.6000
2.0000
2.4000
2.8000
3.2000
3.6000
4.0000

4.4000
4.8000
5.2000
5.6000
6.0000
6.4000
6.8000
7.2000
7.6000
y=
0
0.6000
1.2000
1.8000
2.4000
3.0000
3.6000
4.2000
4.8000
5.4000
6.0000
6.6000
7.2000
7.8000
8.4000
9.0000
9.6000
10.2000
10.8000
11.4000
z=
0
2
4
6
8
10
12
14
16
18
20
22

24
26
28
30
32
34
36
38
a) construir una matriz de 20 filas por 3 columnas con los vectores definidos anteriormente.
R=
0
0.4000
0.8000
1.2000
1.6000
2.0000
2.4000
2.8000
3.2000
3.6000
4.4000
4.8000
5.2000
5.4000
5.6000
6.0000
6.4000
6.8000
7.2000
7.6000

0
0.6000
1.2000
1.8000
2.4000
3.0000
3.6000
4.2000
4.8000
5.4000
6.0000
6.6000
7.2000
7.8000
8.4000
9.0000
9.6000
10.2000
10.8000
11.4000

0
2
4
6
8
10
12
14
16
18
20
22
24
26
28
30
32
34
36
38

b) Hallar el mximo de la matriz y ubicar en qu posicin se encuentra.


>> t=max(R)
ans =
11.4000
R(20,2)
8) lea el archivo matriz. Dat guardado en el disco.dat (no hay archivo)

9) construya las siguientes graficas, definiendo el vector x con 50 puntos. Poner titulo a cada
grafica as como nombres a los ejes:
a) funcin ex, con x definido en el intervalo (0.5, 2.5).
>> x=0.5:0.0408:2.5
x=
Columns 1 through 9
0.5000 0.5408 0.5816 0.6224 0.6632 0.7040
Columns 10 through 18
0.8672 0.9080 0.9488 0.9896 1.0304 1.0712
Columns 19 through 27
1.2344 1.2752 1.3160 1.3568 1.3976 1.4384
Columns 28 through 36
1.6016 1.6424 1.6832 1.7240 1.7648 1.8056
Columns 37 through 45
1.9688 2.0096 2.0504 2.0912 2.1320 2.1728
Columns 46 through 50
2.3360 2.3768 2.4176 2.4584 2.4992
>> exp(x)
ans =
Columns 1 through 9
1.6487 1.7174 1.7889 1.8634 1.9410 2.0218
Columns 10 through 18
2.3802 2.4794 2.5826 2.6902 2.8022 2.9189
Columns 19 through 27
3.4363 3.5794 3.7285 3.8837 4.0455 4.2139
Columns 28 through 36
4.9610 5.1676 5.3828 5.6069 5.8404 6.0836
Columns 37 through 45
7.1621 7.4603 7.7710 8.0946 8.4317 8.7828
Columns 46 through 50
10.3398 10.7704 11.2189 11.6861 12.1728

0.7448 0.7856 0.8264


1.1120 1.1528 1.1936
1.4792 1.5200 1.5608
1.8464 1.8872 1.9280
2.2136 2.2544 2.2952

2.1060 2.1937 2.2851


3.0404 3.1670 3.2989
4.3894 4.5722 4.7626
6.3370 6.6009 6.8757
9.1486 9.5296 9.9264

x
Funcin

b) Funcin sin(x) con x definido en el intervalo (0,4).


> x=0:0.2513:12.3150
x=
Columns 1 through 9
0 0.2513 0.5026 0.7539 1.0052 1.2565 1.5078 1.7591 2.0104
Columns 10 through 18
2.2617 2.5130 2.7643 3.0156 3.2669 3.5182 3.7695 4.0208 4.2721
Columns 19 through 27
4.5234 4.7747 5.0260 5.2773 5.5286 5.7799 6.0312 6.2825 6.5338
Columns 28 through 36
6.7851 7.0364 7.2877 7.5390 7.7903 8.0416 8.2929 8.5442 8.7955
Columns 37 through 45
9.0468 9.2981 9.5494 9.8007 10.0520 10.3033 10.5546 10.8059 11.0572
Columns 46 through 50
11.3085 11.5598 11.8111 12.0624 12.3137

>> sin(x)
ans =
Columns 1 through 9
0 0.2487 0.4817 0.6845 0.8443 0.9510 0.9980 0.9823 0.9049
Columns 10 through 18
0.7707 0.5880 0.3684 0.1257 -0.1250 -0.3678 -0.5875 -0.7702 -0.9046
Columns 19 through 27
-0.9822 -0.9981 -0.9512 -0.8446 -0.6850 -0.4823 -0.2493 -0.0007 0.2480
Columns 28 through 36
0.4811 0.6840 0.8439 0.9508 0.9980 0.9825 0.9052 0.7711 0.5886
Columns 37 through 45
0.3690 0.1263 -0.1243 -0.3671 -0.5869 -0.7698 -0.9043 -0.9821 -0.9981
Columns 46 through 50
-0.9514 -0.8450 -0.6855 -0.4829 -0.2500

Funcin seno de x

10) grafique las funciones: y=cos(X) e y=x, para o<x<2, en la misma ventana , con 100 puntos c/u.
Aplique el comando zoom para determinar en forma aproximada el punto de interseccin;
investigue el comando ginput. Implemente un algoritmo que le permia hallar el punto de
interseccin entre ambas funciones.
>> x=0:.0202:2
x=
Columns 1 through 9
0 0.0202 0.0404 0.0606 0.0808 0.1010 0.1212 0.1414 0.1616
Columns 10 through 18
0.1818 0.2020 0.2222 0.2424 0.2626 0.2828 0.3030 0.3232 0.3434
Columns 19 through 27
0.3636 0.3838 0.4040 0.4242 0.4444 0.4646 0.4848 0.5050 0.5252
Columns 28 through 36
0.5454 0.5656 0.5858 0.6060 0.6262 0.6464 0.6666 0.6868 0.7070
Columns 37 through 45
0.7272 0.7474 0.7676 0.7878 0.8080 0.8282 0.8484 0.8686 0.8888
Columns 46 through 54
0.9090 0.9292 0.9494 0.9696 0.9898 1.0100 1.0302 1.0504 1.0706
Columns 55 through 63
1.0908 1.1110 1.1312 1.1514 1.1716 1.1918 1.2120 1.2322 1.2524
Columns 64 through 72
1.2726 1.2928 1.3130 1.3332 1.3534 1.3736 1.3938 1.4140 1.4342
Columns 73 through 81
1.4544 1.4746 1.4948 1.5150 1.5352 1.5554 1.5756 1.5958 1.6160
Columns 82 through 90
1.6362 1.6564 1.6766 1.6968 1.7170 1.7372 1.7574 1.7776 1.7978
Columns 91 through 99

1.8180 1.8382 1.8584 1.8786 1.8988 1.9190 1.9392 1.9594 1.9796


Column 100
1.9998
>> cos(x)
ans =
Columns 1 through 9
1.0000 0.9998 0.9992 0.9982 0.9967 0.9949 0.9927 0.9900 0.9870
Columns 10 through 18
0.9835 0.9797 0.9754 0.9708 0.9657 0.9603 0.9544 0.9482 0.9416
Columns 19 through 27
0.9346 0.9272 0.9195 0.9114 0.9029 0.8940 0.8848 0.8752 0.8652
Columns 28 through 36
0.8549 0.8443 0.8333 0.8219 0.8103 0.7983 0.7859 0.7733 0.7603
Columns 37 through 45
0.7470 0.7335 0.7196 0.7054 0.6909 0.6762 0.6612 0.6459 0.6303
Columns 46 through 54
0.6145 0.5985 0.5822 0.5656 0.5489 0.5319 0.5146 0.4972 0.4796
Columns 55 through 63
0.4618 0.4438 0.4256 0.4072 0.3887 0.3700 0.3511 0.3322 0.3130
Columns 64 through 72
0.2938 0.2744 0.2550 0.2354 0.2157 0.1959 0.1761 0.1562 0.1362
Columns 73 through 81
0.1161 0.0960 0.0759 0.0558 0.0356 0.0154 -0.0048 -0.0250 -0.0452
Columns 82 through 90
-0.0654 -0.0855 -0.1056 -0.1257 -0.1457 -0.1656 -0.1855 -0.2053 -0.2251
Columns 91 through 99

-0.2447 -0.2642 -0.2837 -0.3030 -0.3222 -0.3412 -0.3601 -0.3789 -0.3975


Column 100
-0.4160

funciones: y=cos(X) e y=x


y

La interseccin ser 37.58, 0.739(con ayuda del zoom).


11) mediante el comando subplot cree una figura con cuatro graficas, tal que en la primera grafica
(contando de arriba para abajo, y de izquierda a derecha) se represntela funcin y=sen(3x),en la
segunda y=cos(3x),en la tercera y=sen(6x) y en la cuarta y=cos(6x),con 0<x<1.nombre a los
ejes de cada uno.
>> x=0:0.01:1
x=
Columns 1 through 9
0 0.0100 0.0200 0.0300 0.0400 0.0500 0.0600 0.0700 0.0800
Columns 10 through 18
0.0900 0.1000 0.1100 0.1200 0.1300 0.1400 0.1500 0.1600 0.1700

Columns 19 through 27
0.1800 0.1900 0.2000 0.2100 0.2200 0.2300 0.2400 0.2500 0.2600
Columns 28 through 36
0.2700 0.2800 0.2900 0.3000 0.3100 0.3200 0.3300 0.3400 0.3500
Columns 37 through 45
0.3600 0.3700 0.3800 0.3900 0.4000 0.4100 0.4200 0.4300 0.4400
Columns 46 through 54
0.4500 0.4600 0.4700 0.4800 0.4900 0.5000 0.5100 0.5200 0.5300
Columns 55 through 63
0.5400 0.5500 0.5600 0.5700 0.5800 0.5900 0.6000 0.6100 0.6200
Columns 64 through 72
0.6300 0.6400 0.6500 0.6600 0.6700 0.6800 0.6900 0.7000 0.7100
Columns 73 through 81
0.7200 0.7300 0.7400 0.7500 0.7600 0.7700 0.7800 0.7900 0.8000
Columns 82 through 90
0.8100 0.8200 0.8300 0.8400 0.8500 0.8600 0.8700 0.8800 0.8900
Columns 91 through 99
0.9000 0.9100 0.9200 0.9300 0.9400 0.9500 0.9600 0.9700 0.9800
Columns 100 through 101
0.9900 1.0000
>> y1=sin(3*pi*x)
y1 =
Columns 1 through 9
0 0.0941 0.1874 0.2790 0.3681 0.4540 0.5358 0.6129 0.6845
Columns 10 through 18
0.7501 0.8090 0.8607 0.9048 0.9409 0.9686 0.9877 0.9980 0.9995

Columns 19 through 27
0.9921 0.9759 0.9511 0.9178 0.8763 0.8271 0.7705 0.7071 0.6374
Columns 28 through 36
0.5621 0.4818 0.3971 0.3090 0.2181 0.1253 0.0314 -0.0628 -0.1564
Columns 37 through 45
-0.2487 -0.3387 -0.4258 -0.5090 -0.5878 -0.6613 -0.7290 -0.7902 -0.8443
Columns 46 through 54
-0.8910 -0.9298 -0.9603 -0.9823 -0.9956 -1.0000 -0.9956 -0.9823 -0.9603
Columns 55 through 63
-0.9298 -0.8910 -0.8443 -0.7902 -0.7290 -0.6613 -0.5878 -0.5090 -0.4258
Columns 64 through 72
-0.3387 -0.2487 -0.1564 -0.0628 0.0314 0.1253 0.2181 0.3090 0.3971
Columns 73 through 81
0.4818 0.5621 0.6374 0.7071 0.7705 0.8271 0.8763 0.9178 0.9511
Columns 82 through 90
0.9759 0.9921 0.9995 0.9980 0.9877 0.9686 0.9409 0.9048 0.8607
Columns 91 through 99
0.8090 0.7501 0.6845 0.6129 0.5358 0.4540 0.3681 0.2790 0.1874
Columns 100 through 101
0.0941 0.0000
>> y2=cos(3*pi*x)
y2 =
Columns 1 through 9
1.0000 0.9956 0.9823 0.9603 0.9298 0.8910 0.8443 0.7902 0.7290
Columns 10 through 18
0.6613 0.5878 0.5090 0.4258 0.3387 0.2487 0.1564 0.0628 -0.0314

Columns 19 through 27
-0.1253 -0.2181 -0.3090 -0.3971 -0.4818 -0.5621 -0.6374 -0.7071 -0.7705
Columns 28 through 36
-0.8271 -0.8763 -0.9178 -0.9511 -0.9759 -0.9921 -0.9995 -0.9980 -0.9877
Columns 37 through 45
-0.9686 -0.9409 -0.9048 -0.8607 -0.8090 -0.7501 -0.6845 -0.6129 -0.5358
Columns 46 through 54
-0.4540 -0.3681 -0.2790 -0.1874 -0.0941 -0.0000 0.0941 0.1874 0.2790
Columns 55 through 63
0.3681 0.4540 0.5358 0.6129 0.6845 0.7501 0.8090 0.8607 0.9048
Columns 64 through 72
0.9409 0.9686 0.9877 0.9980 0.9995 0.9921 0.9759 0.9511 0.9178
Columns 73 through 81
0.8763 0.8271 0.7705 0.7071 0.6374 0.5621 0.4818 0.3971 0.3090
Columns 82 through 90
0.2181 0.1253 0.0314 -0.0628 -0.1564 -0.2487 -0.3387 -0.4258 -0.5090
Columns 91 through 99
-0.5878 -0.6613 -0.7290 -0.7902 -0.8443 -0.8910 -0.9298 -0.9603 -0.9823
Columns 100 through 101
-0.9956 -1.0000
>> y3=sin(6*pi*x)
y3 =
Columns 1 through 9
0 0.1874 0.3681 0.5358 0.6845 0.8090 0.9048 0.9686 0.9980
Columns 10 through 18
0.9921 0.9511 0.8763 0.7705 0.6374 0.4818 0.3090 0.1253 -0.0628

Columns 19 through 27
-0.2487 -0.4258 -0.5878 -0.7290 -0.8443 -0.9298 -0.9823 -1.0000 -0.9823
Columns 28 through 36
-0.9298 -0.8443 -0.7290 -0.5878 -0.4258 -0.2487 -0.0628 0.1253 0.3090
Columns 37 through 45
0.4818 0.6374 0.7705 0.8763 0.9511 0.9921 0.9980 0.9686 0.9048
Columns 46 through 54
0.8090 0.6845 0.5358 0.3681 0.1874 0.0000 -0.1874 -0.3681 -0.5358
Columns 55 through 63
-0.6845 -0.8090 -0.9048 -0.9686 -0.9980 -0.9921 -0.9511 -0.8763 -0.7705
Columns 64 through 72
-0.6374 -0.4818 -0.3090 -0.1253 0.0628 0.2487 0.4258 0.5878 0.7290
Columns 73 through 81
0.8443 0.9298 0.9823 1.0000 0.9823 0.9298 0.8443 0.7290 0.5878
Columns 82 through 90
0.4258 0.2487 0.0628 -0.1253 -0.3090 -0.4818 -0.6374 -0.7705 -0.8763
Columns 91 through 99
-0.9511 -0.9921 -0.9980 -0.9686 -0.9048 -0.8090 -0.6845 -0.5358 -0.3681
Columns 100 through 101
-0.1874 -0.0000
>> y4=cos(6*pi*x)
y4 =
Columns 1 through 9
1.0000 0.9823 0.9298 0.8443 0.7290 0.5878 0.4258 0.2487 0.0628
Columns 10 through 18
-0.1253 -0.3090 -0.4818 -0.6374 -0.7705 -0.8763 -0.9511 -0.9921 -0.9980

Columns 19 through 27
-0.9686 -0.9048 -0.8090 -0.6845 -0.5358 -0.3681 -0.1874 -0.0000 0.1874
Columns 28 through 36
0.3681 0.5358 0.6845 0.8090 0.9048 0.9686 0.9980 0.9921 0.9511
Columns 37 through 45
0.8763 0.7705 0.6374 0.4818 0.3090 0.1253 -0.0628 -0.2487 -0.4258
Columns 46 through 54
-0.5878 -0.7290 -0.8443 -0.9298 -0.9823 -1.0000 -0.9823 -0.9298 -0.8443
Columns 55 through 63
-0.7290 -0.5878 -0.4258 -0.2487 -0.0628 0.1253 0.3090 0.4818 0.6374
Columns 64 through 72
0.7705 0.8763 0.9511 0.9921 0.9980 0.9686 0.9048 0.8090 0.6845
Columns 73 through 81
0.5358 0.3681 0.1874 0.0000 -0.1874 -0.3681 -0.5358 -0.6845 -0.8090
Columns 82 through 90
-0.9048 -0.9686 -0.9980 -0.9921 -0.9511 -0.8763 -0.7705 -0.6374 -0.4818
Columns 91 through 99
-0.3090 -0.1253 0.0628 0.2487 0.4258 0.5878 0.7290 0.8443 0.9298
Columns 100 through 101
0.9823 1.0000
>> subplot(2,2,1)
>> plot(y1)
>> subplot(2,2,2)
>> plot(y2)
>> subplot(2,2,3)
>> plot(y3)

>> subplot(2,2,4)
>> plot(y4)

La grafica de las funciones con el comando sub plot

12) (no hay archivo)


13) (no hay archivo)
14) (no hay archivo)
15) utilizar el comando ezplot para bosquejar las siguientes funciones:
F(x)=

F(x)=
ezplot('(x^3)')

F(x)=
ezplot('(log(x))')

F(x)=
>> ezplot('(tan(x))')

F(x)= -1
>> ezplot('(x^3-1)')

16) Calcular la derivada de las siguientes funciones y evaluarlas en x=2:


a)
>> syms x
>> y=7*cos(x)+5*cos(x)+x*exp(x)
y=
12*cos(x)+x*exp(x)

>> diff(y)
ans =
-12*sin(x)+exp(x)+x*exp(x)

>> h=diff(y)
h=
-12*sin(x)+exp(x)+x*exp(x)
>> x=2
x=
2
>> l=-12*sin(2)+exp(2)+2*exp(2)
l=
11.2556
b)
>> syms x
>> y=2*x*sin(x)-(x^2-2)*exp(2*x)
y=
2*x*sin(x)-(x^2-2)*exp(2*x)
>> u=diff(y)
u=
2*sin(x)+2*x*cos(x)-2*x*exp(2*x)-2*(x^2-2)*exp(2*x)

>> x=2

x=
2
>> u=2*sin(2)+2*2*cos(2)-2*2*exp(2*2)-2*(2^2-2)*exp(2*2)

u=
-436.6312
c)
>> syms x
>> y=log(x)^x
y=
log(x)^x

>> g=diff(y)
g=
log(x)^x*(log(log(x))+1/log(x))
>> x=2
x=
2
>> k=log(x)^x*(log(log(x))+1/log(x))
k=
0.5171

17. Resolver el sistema de ecuaciones:


a.

x+2y=8; 3x-y=3

>> x= [1 2; 3 -1]
x=
1

>> y= [8; 3]

>> b=x\y

y=

b=

3 -1

b.

2x+2y-z=1 ;

x+2z=0 ;

-x-y=0

>> a= [2 2 -1; 1 0 2; -1 -1
0]
a=

b=

c=

2 -1

-2

-1

-1

-1

>> b= [1; 0; 0]

>> c=a\b

18.- La posicin de una partcula que se mueve en lnea recta esta dad por x(t)=3t-4t+ t, donde x
esta en metros y t est en segundos.
a. Calcule las expresiones para la velocidad y aceleracin instantnea (v (t) y a (t)).
La velocidad:

La aceleracin:

>>syms t

>>syms t

>>diff(3*t-4*t^2+t^3)

>>diff (3*t^2 - 8*t + 3)

ans =

ans =

3*t^2 - 8*t + 3

6*t 8

b. Grafique usando el comando ezplot x(t), v(t) y a(t)


La posicin lo calculamos :>>ezplot(3*t-4*t^2+t^3)

La velocidad :>>ezplot(3*t^2-8*t+3)

La aceleracin :>>ezplot(6*t - 8)

c. Determine la posicin, la velocidad y aceleracin de la partcula en t=0.5 y t=4.


Creamos un programa con los siguientes datos :
function y= prueba(x)
y=3*x-4*x^2+x^3
y=3*x^2-8*x
y=6*x-8
end

y luego en la ventana de trabajo:


>> y=prueba(0.5)

>> y=prueba(4)

y = es posicin

y =es posicin

0.6250
y = es velocidad
-3.2500
y = es aceleracin
-5

12
y =es velocidad
16
y =es aceleracin
16

d. Para qu valores de t la velocidad de la partcula es nula?En qu posicin se encuentra en


esos instantes?
Igualando la ecuacin a cero obtenemos el valor q es de 8/3.
La posicin ser:
>> y=prueba(8/3)
y=
-1.4815

19.- La velocidad de una partcula que se mueve en el plano xy est dada por : v =(6t-4t)i+8j.
Aqu v est en metros por segundo y t >0 est en segundos.
a. Cul es la aceleracin cuando t =3s

por v=(6t-4t^2)i+8j.
>> syms t
>> i=6*t-4*(t^2)
i=
6*t-4*t^2

>> j=8
j=
6*t-4*t^2+8

>> l=diff(i+j)
l=
6-8*t
8
>> m=i+j
m=

6*t-4*t^2+8

>> l=diff(i+j)
l=
6-8*t

>> t=3
t=
3
>> l=diff(i+j)
l=
6-8*t

>> l=6-8*t
l=
-18

b. Cuando, si alguna vez sucede, es la aceleracin cero


c. cuando si sucede la velocidad es cero

20.- Se realizo una experiencia para estudiar el movimiento de un pndulo . Los datos fueron
tomados con una interface . Para cada una de las longitudes utilizadas
(L=10cm,20cm,30cm,40cm.50cm.60cm) se almacenaron los datos en archivos denominados
datos _i.dat, donde i representa el numero de archivo . En la primera columna esta almacenando
el tiempo , en la segunda la posicin . Utilizando el comando for escriba un programa que
permita:
a. Leer los archivos. (no hay archivo)
b. Graficar la posicin en funcin del tiempo para cada longitud.
c. Calcular el periodo para cada longitud .Puede utilizar el comando ginput.
d. Graficar el periodo en funcin de la longitud del hilo
e. Teniendo en cuenta que la dependencia del periodo T con la longitud del hilo L, para
pequeas oscilaciones , est dada por :

T=

Superponga al grafico realizado en la parte d. la funcin terica utilizando el comando ezplot.


Para ello utilice g=9.8m/s.

21) escriba un programa para determinar si un nmero es primo


function primoIII(N)
i=2;
K=sqrt(N);
while 1
D=N/i;
if D==fix(D)
disp('No es primo')
break
end
i=i+1;
if i>K
disp('Es primo')
break
end
end
end
>>
Es
>>
Es
>>
No

primoIII(5)
primo
primoIII(13)
primo
primoIII(8)
es primo

22. Escriba un programa que analice cada uno de los elementos de un vector y determine si es
par o impar y en qu posicin esta.
23. escriba un script que determine si un ao dado es bisiesto (nota: debe ser mltiplo de 4 y no
mltiplo de 100). El ao debe ser ingresado desde la pantalla, y el resultado mostrado en la
pantalla.

function n = input(n);
x = mod(n, 4) == 0; y = mod(n, 100) == 0; z = mod(n, 400)
== 0;
if (x & y & z) | (x & ~y & ~z)
disp('Es ao bisiesto')
else
disp('No es ao bisiesto')
end
>> n = input(2012)
Es ao bisiesto

n=

2012

>> n = input(1993)
No es ao bisiesto

n=

1993

>> n = input(2008)
Es ao bisiesto

n=

2008

>> n = input(1000)
No es ao bisiesto

n=

1000

>> n = input(1824)
Es ao bisiesto

n=

1824
25. La sucesin de Fibonacci es tal que cada elemento es la suma de los anteriores. Los
elementos inciales son 0 y 1 y a partir de ellos se pueden calcular los dems. Calcule los
elementos de la serie de Fibonacci menores que 100.
26. Escriba un programa que calcule los cuadrados de los nmeros enteros, hasta que el
cuadrado sea mayor o igual a 100.
27.-(no hay archivo)

28.-dado un numero m, calcular el cuadrado de ese nmero solo si m es mayor que 5.en caso
contrario escribe un mensaje de error

Function f=(m)^2
For m=1;m
If m>5
error
F=(m)^2
End

F=(2)

>> error
F=(6)

>>36