The sum of elements by multiplying two different vectors
1 次查看(过去 30 天)
显示 更早的评论
Jeah MK
2022-1-28
I have an equation like this:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/876535/image.png)
where vector a = 1:1:10 and vector time t= 0:0.001:1;
and b should be resulted in length of t (1000 points).
I have tried this, but it didn't work. Anyone can help me with this? Thank you!
for i = 1:length(t)
b = 0;
for n = 1:length(a)
b = b + a(1,n)*t(1,i);
end
end
1 个评论
Stephen23
2022-1-28
"b should be resulted in length of t (1000 points). "
Note that t has 1001 elements, not 1000: https://en.wikipedia.org/wiki/Off-by-one_error#Fencepost_error
回答(1 个)
Voss
2022-1-28
a = 1:10;
t = 0:0.001:1;
b = zeros(size(t)); % it is known that b is to be the same size as t
for n = 1:numel(a)
b = b + a(n)*t;
end
disp(b)
Columns 1 through 22
0 0.0550 0.1100 0.1650 0.2200 0.2750 0.3300 0.3850 0.4400 0.4950 0.5500 0.6050 0.6600 0.7150 0.7700 0.8250 0.8800 0.9350 0.9900 1.0450 1.1000 1.1550
Columns 23 through 44
1.2100 1.2650 1.3200 1.3750 1.4300 1.4850 1.5400 1.5950 1.6500 1.7050 1.7600 1.8150 1.8700 1.9250 1.9800 2.0350 2.0900 2.1450 2.2000 2.2550 2.3100 2.3650
Columns 45 through 66
2.4200 2.4750 2.5300 2.5850 2.6400 2.6950 2.7500 2.8050 2.8600 2.9150 2.9700 3.0250 3.0800 3.1350 3.1900 3.2450 3.3000 3.3550 3.4100 3.4650 3.5200 3.5750
Columns 67 through 88
3.6300 3.6850 3.7400 3.7950 3.8500 3.9050 3.9600 4.0150 4.0700 4.1250 4.1800 4.2350 4.2900 4.3450 4.4000 4.4550 4.5100 4.5650 4.6200 4.6750 4.7300 4.7850
Columns 89 through 110
4.8400 4.8950 4.9500 5.0050 5.0600 5.1150 5.1700 5.2250 5.2800 5.3350 5.3900 5.4450 5.5000 5.5550 5.6100 5.6650 5.7200 5.7750 5.8300 5.8850 5.9400 5.9950
Columns 111 through 132
6.0500 6.1050 6.1600 6.2150 6.2700 6.3250 6.3800 6.4350 6.4900 6.5450 6.6000 6.6550 6.7100 6.7650 6.8200 6.8750 6.9300 6.9850 7.0400 7.0950 7.1500 7.2050
Columns 133 through 154
7.2600 7.3150 7.3700 7.4250 7.4800 7.5350 7.5900 7.6450 7.7000 7.7550 7.8100 7.8650 7.9200 7.9750 8.0300 8.0850 8.1400 8.1950 8.2500 8.3050 8.3600 8.4150
Columns 155 through 176
8.4700 8.5250 8.5800 8.6350 8.6900 8.7450 8.8000 8.8550 8.9100 8.9650 9.0200 9.0750 9.1300 9.1850 9.2400 9.2950 9.3500 9.4050 9.4600 9.5150 9.5700 9.6250
Columns 177 through 198
9.6800 9.7350 9.7900 9.8450 9.9000 9.9550 10.0100 10.0650 10.1200 10.1750 10.2300 10.2850 10.3400 10.3950 10.4500 10.5050 10.5600 10.6150 10.6700 10.7250 10.7800 10.8350
Columns 199 through 220
10.8900 10.9450 11.0000 11.0550 11.1100 11.1650 11.2200 11.2750 11.3300 11.3850 11.4400 11.4950 11.5500 11.6050 11.6600 11.7150 11.7700 11.8250 11.8800 11.9350 11.9900 12.0450
Columns 221 through 242
12.1000 12.1550 12.2100 12.2650 12.3200 12.3750 12.4300 12.4850 12.5400 12.5950 12.6500 12.7050 12.7600 12.8150 12.8700 12.9250 12.9800 13.0350 13.0900 13.1450 13.2000 13.2550
Columns 243 through 264
13.3100 13.3650 13.4200 13.4750 13.5300 13.5850 13.6400 13.6950 13.7500 13.8050 13.8600 13.9150 13.9700 14.0250 14.0800 14.1350 14.1900 14.2450 14.3000 14.3550 14.4100 14.4650
Columns 265 through 286
14.5200 14.5750 14.6300 14.6850 14.7400 14.7950 14.8500 14.9050 14.9600 15.0150 15.0700 15.1250 15.1800 15.2350 15.2900 15.3450 15.4000 15.4550 15.5100 15.5650 15.6200 15.6750
Columns 287 through 308
15.7300 15.7850 15.8400 15.8950 15.9500 16.0050 16.0600 16.1150 16.1700 16.2250 16.2800 16.3350 16.3900 16.4450 16.5000 16.5550 16.6100 16.6650 16.7200 16.7750 16.8300 16.8850
Columns 309 through 330
16.9400 16.9950 17.0500 17.1050 17.1600 17.2150 17.2700 17.3250 17.3800 17.4350 17.4900 17.5450 17.6000 17.6550 17.7100 17.7650 17.8200 17.8750 17.9300 17.9850 18.0400 18.0950
Columns 331 through 352
18.1500 18.2050 18.2600 18.3150 18.3700 18.4250 18.4800 18.5350 18.5900 18.6450 18.7000 18.7550 18.8100 18.8650 18.9200 18.9750 19.0300 19.0850 19.1400 19.1950 19.2500 19.3050
Columns 353 through 374
19.3600 19.4150 19.4700 19.5250 19.5800 19.6350 19.6900 19.7450 19.8000 19.8550 19.9100 19.9650 20.0200 20.0750 20.1300 20.1850 20.2400 20.2950 20.3500 20.4050 20.4600 20.5150
Columns 375 through 396
20.5700 20.6250 20.6800 20.7350 20.7900 20.8450 20.9000 20.9550 21.0100 21.0650 21.1200 21.1750 21.2300 21.2850 21.3400 21.3950 21.4500 21.5050 21.5600 21.6150 21.6700 21.7250
Columns 397 through 418
21.7800 21.8350 21.8900 21.9450 22.0000 22.0550 22.1100 22.1650 22.2200 22.2750 22.3300 22.3850 22.4400 22.4950 22.5500 22.6050 22.6600 22.7150 22.7700 22.8250 22.8800 22.9350
Columns 419 through 440
22.9900 23.0450 23.1000 23.1550 23.2100 23.2650 23.3200 23.3750 23.4300 23.4850 23.5400 23.5950 23.6500 23.7050 23.7600 23.8150 23.8700 23.9250 23.9800 24.0350 24.0900 24.1450
Columns 441 through 462
24.2000 24.2550 24.3100 24.3650 24.4200 24.4750 24.5300 24.5850 24.6400 24.6950 24.7500 24.8050 24.8600 24.9150 24.9700 25.0250 25.0800 25.1350 25.1900 25.2450 25.3000 25.3550
Columns 463 through 484
25.4100 25.4650 25.5200 25.5750 25.6300 25.6850 25.7400 25.7950 25.8500 25.9050 25.9600 26.0150 26.0700 26.1250 26.1800 26.2350 26.2900 26.3450 26.4000 26.4550 26.5100 26.5650
Columns 485 through 506
26.6200 26.6750 26.7300 26.7850 26.8400 26.8950 26.9500 27.0050 27.0600 27.1150 27.1700 27.2250 27.2800 27.3350 27.3900 27.4450 27.5000 27.5550 27.6100 27.6650 27.7200 27.7750
Columns 507 through 528
27.8300 27.8850 27.9400 27.9950 28.0500 28.1050 28.1600 28.2150 28.2700 28.3250 28.3800 28.4350 28.4900 28.5450 28.6000 28.6550 28.7100 28.7650 28.8200 28.8750 28.9300 28.9850
Columns 529 through 550
29.0400 29.0950 29.1500 29.2050 29.2600 29.3150 29.3700 29.4250 29.4800 29.5350 29.5900 29.6450 29.7000 29.7550 29.8100 29.8650 29.9200 29.9750 30.0300 30.0850 30.1400 30.1950
Columns 551 through 572
30.2500 30.3050 30.3600 30.4150 30.4700 30.5250 30.5800 30.6350 30.6900 30.7450 30.8000 30.8550 30.9100 30.9650 31.0200 31.0750 31.1300 31.1850 31.2400 31.2950 31.3500 31.4050
Columns 573 through 594
31.4600 31.5150 31.5700 31.6250 31.6800 31.7350 31.7900 31.8450 31.9000 31.9550 32.0100 32.0650 32.1200 32.1750 32.2300 32.2850 32.3400 32.3950 32.4500 32.5050 32.5600 32.6150
Columns 595 through 616
32.6700 32.7250 32.7800 32.8350 32.8900 32.9450 33.0000 33.0550 33.1100 33.1650 33.2200 33.2750 33.3300 33.3850 33.4400 33.4950 33.5500 33.6050 33.6600 33.7150 33.7700 33.8250
Columns 617 through 638
33.8800 33.9350 33.9900 34.0450 34.1000 34.1550 34.2100 34.2650 34.3200 34.3750 34.4300 34.4850 34.5400 34.5950 34.6500 34.7050 34.7600 34.8150 34.8700 34.9250 34.9800 35.0350
Columns 639 through 660
35.0900 35.1450 35.2000 35.2550 35.3100 35.3650 35.4200 35.4750 35.5300 35.5850 35.6400 35.6950 35.7500 35.8050 35.8600 35.9150 35.9700 36.0250 36.0800 36.1350 36.1900 36.2450
Columns 661 through 682
36.3000 36.3550 36.4100 36.4650 36.5200 36.5750 36.6300 36.6850 36.7400 36.7950 36.8500 36.9050 36.9600 37.0150 37.0700 37.1250 37.1800 37.2350 37.2900 37.3450 37.4000 37.4550
Columns 683 through 704
37.5100 37.5650 37.6200 37.6750 37.7300 37.7850 37.8400 37.8950 37.9500 38.0050 38.0600 38.1150 38.1700 38.2250 38.2800 38.3350 38.3900 38.4450 38.5000 38.5550 38.6100 38.6650
Columns 705 through 726
38.7200 38.7750 38.8300 38.8850 38.9400 38.9950 39.0500 39.1050 39.1600 39.2150 39.2700 39.3250 39.3800 39.4350 39.4900 39.5450 39.6000 39.6550 39.7100 39.7650 39.8200 39.8750
Columns 727 through 748
39.9300 39.9850 40.0400 40.0950 40.1500 40.2050 40.2600 40.3150 40.3700 40.4250 40.4800 40.5350 40.5900 40.6450 40.7000 40.7550 40.8100 40.8650 40.9200 40.9750 41.0300 41.0850
Columns 749 through 770
41.1400 41.1950 41.2500 41.3050 41.3600 41.4150 41.4700 41.5250 41.5800 41.6350 41.6900 41.7450 41.8000 41.8550 41.9100 41.9650 42.0200 42.0750 42.1300 42.1850 42.2400 42.2950
Columns 771 through 792
42.3500 42.4050 42.4600 42.5150 42.5700 42.6250 42.6800 42.7350 42.7900 42.8450 42.9000 42.9550 43.0100 43.0650 43.1200 43.1750 43.2300 43.2850 43.3400 43.3950 43.4500 43.5050
Columns 793 through 814
43.5600 43.6150 43.6700 43.7250 43.7800 43.8350 43.8900 43.9450 44.0000 44.0550 44.1100 44.1650 44.2200 44.2750 44.3300 44.3850 44.4400 44.4950 44.5500 44.6050 44.6600 44.7150
Columns 815 through 836
44.7700 44.8250 44.8800 44.9350 44.9900 45.0450 45.1000 45.1550 45.2100 45.2650 45.3200 45.3750 45.4300 45.4850 45.5400 45.5950 45.6500 45.7050 45.7600 45.8150 45.8700 45.9250
Columns 837 through 858
45.9800 46.0350 46.0900 46.1450 46.2000 46.2550 46.3100 46.3650 46.4200 46.4750 46.5300 46.5850 46.6400 46.6950 46.7500 46.8050 46.8600 46.9150 46.9700 47.0250 47.0800 47.1350
Columns 859 through 880
47.1900 47.2450 47.3000 47.3550 47.4100 47.4650 47.5200 47.5750 47.6300 47.6850 47.7400 47.7950 47.8500 47.9050 47.9600 48.0150 48.0700 48.1250 48.1800 48.2350 48.2900 48.3450
Columns 881 through 902
48.4000 48.4550 48.5100 48.5650 48.6200 48.6750 48.7300 48.7850 48.8400 48.8950 48.9500 49.0050 49.0600 49.1150 49.1700 49.2250 49.2800 49.3350 49.3900 49.4450 49.5000 49.5550
Columns 903 through 924
49.6100 49.6650 49.7200 49.7750 49.8300 49.8850 49.9400 49.9950 50.0500 50.1050 50.1600 50.2150 50.2700 50.3250 50.3800 50.4350 50.4900 50.5450 50.6000 50.6550 50.7100 50.7650
Columns 925 through 946
50.8200 50.8750 50.9300 50.9850 51.0400 51.0950 51.1500 51.2050 51.2600 51.3150 51.3700 51.4250 51.4800 51.5350 51.5900 51.6450 51.7000 51.7550 51.8100 51.8650 51.9200 51.9750
Columns 947 through 968
52.0300 52.0850 52.1400 52.1950 52.2500 52.3050 52.3600 52.4150 52.4700 52.5250 52.5800 52.6350 52.6900 52.7450 52.8000 52.8550 52.9100 52.9650 53.0200 53.0750 53.1300 53.1850
Columns 969 through 990
53.2400 53.2950 53.3500 53.4050 53.4600 53.5150 53.5700 53.6250 53.6800 53.7350 53.7900 53.8450 53.9000 53.9550 54.0100 54.0650 54.1200 54.1750 54.2300 54.2850 54.3400 54.3950
Columns 991 through 1,001
54.4500 54.5050 54.5600 54.6150 54.6700 54.7250 54.7800 54.8350 54.8900 54.9450 55.0000
Or, more like what you had attempted:
a = 1:10;
t = 0:0.001:1;
b = zeros(size(t)); % it is known that b is to be the same size as t
for i = 1:numel(t)
for n = 1:numel(a)
b(i) = b(i) + a(n)*t(i);
end
end
disp(b)
Columns 1 through 22
0 0.0550 0.1100 0.1650 0.2200 0.2750 0.3300 0.3850 0.4400 0.4950 0.5500 0.6050 0.6600 0.7150 0.7700 0.8250 0.8800 0.9350 0.9900 1.0450 1.1000 1.1550
Columns 23 through 44
1.2100 1.2650 1.3200 1.3750 1.4300 1.4850 1.5400 1.5950 1.6500 1.7050 1.7600 1.8150 1.8700 1.9250 1.9800 2.0350 2.0900 2.1450 2.2000 2.2550 2.3100 2.3650
Columns 45 through 66
2.4200 2.4750 2.5300 2.5850 2.6400 2.6950 2.7500 2.8050 2.8600 2.9150 2.9700 3.0250 3.0800 3.1350 3.1900 3.2450 3.3000 3.3550 3.4100 3.4650 3.5200 3.5750
Columns 67 through 88
3.6300 3.6850 3.7400 3.7950 3.8500 3.9050 3.9600 4.0150 4.0700 4.1250 4.1800 4.2350 4.2900 4.3450 4.4000 4.4550 4.5100 4.5650 4.6200 4.6750 4.7300 4.7850
Columns 89 through 110
4.8400 4.8950 4.9500 5.0050 5.0600 5.1150 5.1700 5.2250 5.2800 5.3350 5.3900 5.4450 5.5000 5.5550 5.6100 5.6650 5.7200 5.7750 5.8300 5.8850 5.9400 5.9950
Columns 111 through 132
6.0500 6.1050 6.1600 6.2150 6.2700 6.3250 6.3800 6.4350 6.4900 6.5450 6.6000 6.6550 6.7100 6.7650 6.8200 6.8750 6.9300 6.9850 7.0400 7.0950 7.1500 7.2050
Columns 133 through 154
7.2600 7.3150 7.3700 7.4250 7.4800 7.5350 7.5900 7.6450 7.7000 7.7550 7.8100 7.8650 7.9200 7.9750 8.0300 8.0850 8.1400 8.1950 8.2500 8.3050 8.3600 8.4150
Columns 155 through 176
8.4700 8.5250 8.5800 8.6350 8.6900 8.7450 8.8000 8.8550 8.9100 8.9650 9.0200 9.0750 9.1300 9.1850 9.2400 9.2950 9.3500 9.4050 9.4600 9.5150 9.5700 9.6250
Columns 177 through 198
9.6800 9.7350 9.7900 9.8450 9.9000 9.9550 10.0100 10.0650 10.1200 10.1750 10.2300 10.2850 10.3400 10.3950 10.4500 10.5050 10.5600 10.6150 10.6700 10.7250 10.7800 10.8350
Columns 199 through 220
10.8900 10.9450 11.0000 11.0550 11.1100 11.1650 11.2200 11.2750 11.3300 11.3850 11.4400 11.4950 11.5500 11.6050 11.6600 11.7150 11.7700 11.8250 11.8800 11.9350 11.9900 12.0450
Columns 221 through 242
12.1000 12.1550 12.2100 12.2650 12.3200 12.3750 12.4300 12.4850 12.5400 12.5950 12.6500 12.7050 12.7600 12.8150 12.8700 12.9250 12.9800 13.0350 13.0900 13.1450 13.2000 13.2550
Columns 243 through 264
13.3100 13.3650 13.4200 13.4750 13.5300 13.5850 13.6400 13.6950 13.7500 13.8050 13.8600 13.9150 13.9700 14.0250 14.0800 14.1350 14.1900 14.2450 14.3000 14.3550 14.4100 14.4650
Columns 265 through 286
14.5200 14.5750 14.6300 14.6850 14.7400 14.7950 14.8500 14.9050 14.9600 15.0150 15.0700 15.1250 15.1800 15.2350 15.2900 15.3450 15.4000 15.4550 15.5100 15.5650 15.6200 15.6750
Columns 287 through 308
15.7300 15.7850 15.8400 15.8950 15.9500 16.0050 16.0600 16.1150 16.1700 16.2250 16.2800 16.3350 16.3900 16.4450 16.5000 16.5550 16.6100 16.6650 16.7200 16.7750 16.8300 16.8850
Columns 309 through 330
16.9400 16.9950 17.0500 17.1050 17.1600 17.2150 17.2700 17.3250 17.3800 17.4350 17.4900 17.5450 17.6000 17.6550 17.7100 17.7650 17.8200 17.8750 17.9300 17.9850 18.0400 18.0950
Columns 331 through 352
18.1500 18.2050 18.2600 18.3150 18.3700 18.4250 18.4800 18.5350 18.5900 18.6450 18.7000 18.7550 18.8100 18.8650 18.9200 18.9750 19.0300 19.0850 19.1400 19.1950 19.2500 19.3050
Columns 353 through 374
19.3600 19.4150 19.4700 19.5250 19.5800 19.6350 19.6900 19.7450 19.8000 19.8550 19.9100 19.9650 20.0200 20.0750 20.1300 20.1850 20.2400 20.2950 20.3500 20.4050 20.4600 20.5150
Columns 375 through 396
20.5700 20.6250 20.6800 20.7350 20.7900 20.8450 20.9000 20.9550 21.0100 21.0650 21.1200 21.1750 21.2300 21.2850 21.3400 21.3950 21.4500 21.5050 21.5600 21.6150 21.6700 21.7250
Columns 397 through 418
21.7800 21.8350 21.8900 21.9450 22.0000 22.0550 22.1100 22.1650 22.2200 22.2750 22.3300 22.3850 22.4400 22.4950 22.5500 22.6050 22.6600 22.7150 22.7700 22.8250 22.8800 22.9350
Columns 419 through 440
22.9900 23.0450 23.1000 23.1550 23.2100 23.2650 23.3200 23.3750 23.4300 23.4850 23.5400 23.5950 23.6500 23.7050 23.7600 23.8150 23.8700 23.9250 23.9800 24.0350 24.0900 24.1450
Columns 441 through 462
24.2000 24.2550 24.3100 24.3650 24.4200 24.4750 24.5300 24.5850 24.6400 24.6950 24.7500 24.8050 24.8600 24.9150 24.9700 25.0250 25.0800 25.1350 25.1900 25.2450 25.3000 25.3550
Columns 463 through 484
25.4100 25.4650 25.5200 25.5750 25.6300 25.6850 25.7400 25.7950 25.8500 25.9050 25.9600 26.0150 26.0700 26.1250 26.1800 26.2350 26.2900 26.3450 26.4000 26.4550 26.5100 26.5650
Columns 485 through 506
26.6200 26.6750 26.7300 26.7850 26.8400 26.8950 26.9500 27.0050 27.0600 27.1150 27.1700 27.2250 27.2800 27.3350 27.3900 27.4450 27.5000 27.5550 27.6100 27.6650 27.7200 27.7750
Columns 507 through 528
27.8300 27.8850 27.9400 27.9950 28.0500 28.1050 28.1600 28.2150 28.2700 28.3250 28.3800 28.4350 28.4900 28.5450 28.6000 28.6550 28.7100 28.7650 28.8200 28.8750 28.9300 28.9850
Columns 529 through 550
29.0400 29.0950 29.1500 29.2050 29.2600 29.3150 29.3700 29.4250 29.4800 29.5350 29.5900 29.6450 29.7000 29.7550 29.8100 29.8650 29.9200 29.9750 30.0300 30.0850 30.1400 30.1950
Columns 551 through 572
30.2500 30.3050 30.3600 30.4150 30.4700 30.5250 30.5800 30.6350 30.6900 30.7450 30.8000 30.8550 30.9100 30.9650 31.0200 31.0750 31.1300 31.1850 31.2400 31.2950 31.3500 31.4050
Columns 573 through 594
31.4600 31.5150 31.5700 31.6250 31.6800 31.7350 31.7900 31.8450 31.9000 31.9550 32.0100 32.0650 32.1200 32.1750 32.2300 32.2850 32.3400 32.3950 32.4500 32.5050 32.5600 32.6150
Columns 595 through 616
32.6700 32.7250 32.7800 32.8350 32.8900 32.9450 33.0000 33.0550 33.1100 33.1650 33.2200 33.2750 33.3300 33.3850 33.4400 33.4950 33.5500 33.6050 33.6600 33.7150 33.7700 33.8250
Columns 617 through 638
33.8800 33.9350 33.9900 34.0450 34.1000 34.1550 34.2100 34.2650 34.3200 34.3750 34.4300 34.4850 34.5400 34.5950 34.6500 34.7050 34.7600 34.8150 34.8700 34.9250 34.9800 35.0350
Columns 639 through 660
35.0900 35.1450 35.2000 35.2550 35.3100 35.3650 35.4200 35.4750 35.5300 35.5850 35.6400 35.6950 35.7500 35.8050 35.8600 35.9150 35.9700 36.0250 36.0800 36.1350 36.1900 36.2450
Columns 661 through 682
36.3000 36.3550 36.4100 36.4650 36.5200 36.5750 36.6300 36.6850 36.7400 36.7950 36.8500 36.9050 36.9600 37.0150 37.0700 37.1250 37.1800 37.2350 37.2900 37.3450 37.4000 37.4550
Columns 683 through 704
37.5100 37.5650 37.6200 37.6750 37.7300 37.7850 37.8400 37.8950 37.9500 38.0050 38.0600 38.1150 38.1700 38.2250 38.2800 38.3350 38.3900 38.4450 38.5000 38.5550 38.6100 38.6650
Columns 705 through 726
38.7200 38.7750 38.8300 38.8850 38.9400 38.9950 39.0500 39.1050 39.1600 39.2150 39.2700 39.3250 39.3800 39.4350 39.4900 39.5450 39.6000 39.6550 39.7100 39.7650 39.8200 39.8750
Columns 727 through 748
39.9300 39.9850 40.0400 40.0950 40.1500 40.2050 40.2600 40.3150 40.3700 40.4250 40.4800 40.5350 40.5900 40.6450 40.7000 40.7550 40.8100 40.8650 40.9200 40.9750 41.0300 41.0850
Columns 749 through 770
41.1400 41.1950 41.2500 41.3050 41.3600 41.4150 41.4700 41.5250 41.5800 41.6350 41.6900 41.7450 41.8000 41.8550 41.9100 41.9650 42.0200 42.0750 42.1300 42.1850 42.2400 42.2950
Columns 771 through 792
42.3500 42.4050 42.4600 42.5150 42.5700 42.6250 42.6800 42.7350 42.7900 42.8450 42.9000 42.9550 43.0100 43.0650 43.1200 43.1750 43.2300 43.2850 43.3400 43.3950 43.4500 43.5050
Columns 793 through 814
43.5600 43.6150 43.6700 43.7250 43.7800 43.8350 43.8900 43.9450 44.0000 44.0550 44.1100 44.1650 44.2200 44.2750 44.3300 44.3850 44.4400 44.4950 44.5500 44.6050 44.6600 44.7150
Columns 815 through 836
44.7700 44.8250 44.8800 44.9350 44.9900 45.0450 45.1000 45.1550 45.2100 45.2650 45.3200 45.3750 45.4300 45.4850 45.5400 45.5950 45.6500 45.7050 45.7600 45.8150 45.8700 45.9250
Columns 837 through 858
45.9800 46.0350 46.0900 46.1450 46.2000 46.2550 46.3100 46.3650 46.4200 46.4750 46.5300 46.5850 46.6400 46.6950 46.7500 46.8050 46.8600 46.9150 46.9700 47.0250 47.0800 47.1350
Columns 859 through 880
47.1900 47.2450 47.3000 47.3550 47.4100 47.4650 47.5200 47.5750 47.6300 47.6850 47.7400 47.7950 47.8500 47.9050 47.9600 48.0150 48.0700 48.1250 48.1800 48.2350 48.2900 48.3450
Columns 881 through 902
48.4000 48.4550 48.5100 48.5650 48.6200 48.6750 48.7300 48.7850 48.8400 48.8950 48.9500 49.0050 49.0600 49.1150 49.1700 49.2250 49.2800 49.3350 49.3900 49.4450 49.5000 49.5550
Columns 903 through 924
49.6100 49.6650 49.7200 49.7750 49.8300 49.8850 49.9400 49.9950 50.0500 50.1050 50.1600 50.2150 50.2700 50.3250 50.3800 50.4350 50.4900 50.5450 50.6000 50.6550 50.7100 50.7650
Columns 925 through 946
50.8200 50.8750 50.9300 50.9850 51.0400 51.0950 51.1500 51.2050 51.2600 51.3150 51.3700 51.4250 51.4800 51.5350 51.5900 51.6450 51.7000 51.7550 51.8100 51.8650 51.9200 51.9750
Columns 947 through 968
52.0300 52.0850 52.1400 52.1950 52.2500 52.3050 52.3600 52.4150 52.4700 52.5250 52.5800 52.6350 52.6900 52.7450 52.8000 52.8550 52.9100 52.9650 53.0200 53.0750 53.1300 53.1850
Columns 969 through 990
53.2400 53.2950 53.3500 53.4050 53.4600 53.5150 53.5700 53.6250 53.6800 53.7350 53.7900 53.8450 53.9000 53.9550 54.0100 54.0650 54.1200 54.1750 54.2300 54.2850 54.3400 54.3950
Columns 991 through 1,001
54.4500 54.5050 54.5600 54.6150 54.6700 54.7250 54.7800 54.8350 54.8900 54.9450 55.0000
Or, most concise:
a = 1:10;
t = 0:0.001:1;
b = sum(a)*t;
disp(b)
Columns 1 through 22
0 0.0550 0.1100 0.1650 0.2200 0.2750 0.3300 0.3850 0.4400 0.4950 0.5500 0.6050 0.6600 0.7150 0.7700 0.8250 0.8800 0.9350 0.9900 1.0450 1.1000 1.1550
Columns 23 through 44
1.2100 1.2650 1.3200 1.3750 1.4300 1.4850 1.5400 1.5950 1.6500 1.7050 1.7600 1.8150 1.8700 1.9250 1.9800 2.0350 2.0900 2.1450 2.2000 2.2550 2.3100 2.3650
Columns 45 through 66
2.4200 2.4750 2.5300 2.5850 2.6400 2.6950 2.7500 2.8050 2.8600 2.9150 2.9700 3.0250 3.0800 3.1350 3.1900 3.2450 3.3000 3.3550 3.4100 3.4650 3.5200 3.5750
Columns 67 through 88
3.6300 3.6850 3.7400 3.7950 3.8500 3.9050 3.9600 4.0150 4.0700 4.1250 4.1800 4.2350 4.2900 4.3450 4.4000 4.4550 4.5100 4.5650 4.6200 4.6750 4.7300 4.7850
Columns 89 through 110
4.8400 4.8950 4.9500 5.0050 5.0600 5.1150 5.1700 5.2250 5.2800 5.3350 5.3900 5.4450 5.5000 5.5550 5.6100 5.6650 5.7200 5.7750 5.8300 5.8850 5.9400 5.9950
Columns 111 through 132
6.0500 6.1050 6.1600 6.2150 6.2700 6.3250 6.3800 6.4350 6.4900 6.5450 6.6000 6.6550 6.7100 6.7650 6.8200 6.8750 6.9300 6.9850 7.0400 7.0950 7.1500 7.2050
Columns 133 through 154
7.2600 7.3150 7.3700 7.4250 7.4800 7.5350 7.5900 7.6450 7.7000 7.7550 7.8100 7.8650 7.9200 7.9750 8.0300 8.0850 8.1400 8.1950 8.2500 8.3050 8.3600 8.4150
Columns 155 through 176
8.4700 8.5250 8.5800 8.6350 8.6900 8.7450 8.8000 8.8550 8.9100 8.9650 9.0200 9.0750 9.1300 9.1850 9.2400 9.2950 9.3500 9.4050 9.4600 9.5150 9.5700 9.6250
Columns 177 through 198
9.6800 9.7350 9.7900 9.8450 9.9000 9.9550 10.0100 10.0650 10.1200 10.1750 10.2300 10.2850 10.3400 10.3950 10.4500 10.5050 10.5600 10.6150 10.6700 10.7250 10.7800 10.8350
Columns 199 through 220
10.8900 10.9450 11.0000 11.0550 11.1100 11.1650 11.2200 11.2750 11.3300 11.3850 11.4400 11.4950 11.5500 11.6050 11.6600 11.7150 11.7700 11.8250 11.8800 11.9350 11.9900 12.0450
Columns 221 through 242
12.1000 12.1550 12.2100 12.2650 12.3200 12.3750 12.4300 12.4850 12.5400 12.5950 12.6500 12.7050 12.7600 12.8150 12.8700 12.9250 12.9800 13.0350 13.0900 13.1450 13.2000 13.2550
Columns 243 through 264
13.3100 13.3650 13.4200 13.4750 13.5300 13.5850 13.6400 13.6950 13.7500 13.8050 13.8600 13.9150 13.9700 14.0250 14.0800 14.1350 14.1900 14.2450 14.3000 14.3550 14.4100 14.4650
Columns 265 through 286
14.5200 14.5750 14.6300 14.6850 14.7400 14.7950 14.8500 14.9050 14.9600 15.0150 15.0700 15.1250 15.1800 15.2350 15.2900 15.3450 15.4000 15.4550 15.5100 15.5650 15.6200 15.6750
Columns 287 through 308
15.7300 15.7850 15.8400 15.8950 15.9500 16.0050 16.0600 16.1150 16.1700 16.2250 16.2800 16.3350 16.3900 16.4450 16.5000 16.5550 16.6100 16.6650 16.7200 16.7750 16.8300 16.8850
Columns 309 through 330
16.9400 16.9950 17.0500 17.1050 17.1600 17.2150 17.2700 17.3250 17.3800 17.4350 17.4900 17.5450 17.6000 17.6550 17.7100 17.7650 17.8200 17.8750 17.9300 17.9850 18.0400 18.0950
Columns 331 through 352
18.1500 18.2050 18.2600 18.3150 18.3700 18.4250 18.4800 18.5350 18.5900 18.6450 18.7000 18.7550 18.8100 18.8650 18.9200 18.9750 19.0300 19.0850 19.1400 19.1950 19.2500 19.3050
Columns 353 through 374
19.3600 19.4150 19.4700 19.5250 19.5800 19.6350 19.6900 19.7450 19.8000 19.8550 19.9100 19.9650 20.0200 20.0750 20.1300 20.1850 20.2400 20.2950 20.3500 20.4050 20.4600 20.5150
Columns 375 through 396
20.5700 20.6250 20.6800 20.7350 20.7900 20.8450 20.9000 20.9550 21.0100 21.0650 21.1200 21.1750 21.2300 21.2850 21.3400 21.3950 21.4500 21.5050 21.5600 21.6150 21.6700 21.7250
Columns 397 through 418
21.7800 21.8350 21.8900 21.9450 22.0000 22.0550 22.1100 22.1650 22.2200 22.2750 22.3300 22.3850 22.4400 22.4950 22.5500 22.6050 22.6600 22.7150 22.7700 22.8250 22.8800 22.9350
Columns 419 through 440
22.9900 23.0450 23.1000 23.1550 23.2100 23.2650 23.3200 23.3750 23.4300 23.4850 23.5400 23.5950 23.6500 23.7050 23.7600 23.8150 23.8700 23.9250 23.9800 24.0350 24.0900 24.1450
Columns 441 through 462
24.2000 24.2550 24.3100 24.3650 24.4200 24.4750 24.5300 24.5850 24.6400 24.6950 24.7500 24.8050 24.8600 24.9150 24.9700 25.0250 25.0800 25.1350 25.1900 25.2450 25.3000 25.3550
Columns 463 through 484
25.4100 25.4650 25.5200 25.5750 25.6300 25.6850 25.7400 25.7950 25.8500 25.9050 25.9600 26.0150 26.0700 26.1250 26.1800 26.2350 26.2900 26.3450 26.4000 26.4550 26.5100 26.5650
Columns 485 through 506
26.6200 26.6750 26.7300 26.7850 26.8400 26.8950 26.9500 27.0050 27.0600 27.1150 27.1700 27.2250 27.2800 27.3350 27.3900 27.4450 27.5000 27.5550 27.6100 27.6650 27.7200 27.7750
Columns 507 through 528
27.8300 27.8850 27.9400 27.9950 28.0500 28.1050 28.1600 28.2150 28.2700 28.3250 28.3800 28.4350 28.4900 28.5450 28.6000 28.6550 28.7100 28.7650 28.8200 28.8750 28.9300 28.9850
Columns 529 through 550
29.0400 29.0950 29.1500 29.2050 29.2600 29.3150 29.3700 29.4250 29.4800 29.5350 29.5900 29.6450 29.7000 29.7550 29.8100 29.8650 29.9200 29.9750 30.0300 30.0850 30.1400 30.1950
Columns 551 through 572
30.2500 30.3050 30.3600 30.4150 30.4700 30.5250 30.5800 30.6350 30.6900 30.7450 30.8000 30.8550 30.9100 30.9650 31.0200 31.0750 31.1300 31.1850 31.2400 31.2950 31.3500 31.4050
Columns 573 through 594
31.4600 31.5150 31.5700 31.6250 31.6800 31.7350 31.7900 31.8450 31.9000 31.9550 32.0100 32.0650 32.1200 32.1750 32.2300 32.2850 32.3400 32.3950 32.4500 32.5050 32.5600 32.6150
Columns 595 through 616
32.6700 32.7250 32.7800 32.8350 32.8900 32.9450 33.0000 33.0550 33.1100 33.1650 33.2200 33.2750 33.3300 33.3850 33.4400 33.4950 33.5500 33.6050 33.6600 33.7150 33.7700 33.8250
Columns 617 through 638
33.8800 33.9350 33.9900 34.0450 34.1000 34.1550 34.2100 34.2650 34.3200 34.3750 34.4300 34.4850 34.5400 34.5950 34.6500 34.7050 34.7600 34.8150 34.8700 34.9250 34.9800 35.0350
Columns 639 through 660
35.0900 35.1450 35.2000 35.2550 35.3100 35.3650 35.4200 35.4750 35.5300 35.5850 35.6400 35.6950 35.7500 35.8050 35.8600 35.9150 35.9700 36.0250 36.0800 36.1350 36.1900 36.2450
Columns 661 through 682
36.3000 36.3550 36.4100 36.4650 36.5200 36.5750 36.6300 36.6850 36.7400 36.7950 36.8500 36.9050 36.9600 37.0150 37.0700 37.1250 37.1800 37.2350 37.2900 37.3450 37.4000 37.4550
Columns 683 through 704
37.5100 37.5650 37.6200 37.6750 37.7300 37.7850 37.8400 37.8950 37.9500 38.0050 38.0600 38.1150 38.1700 38.2250 38.2800 38.3350 38.3900 38.4450 38.5000 38.5550 38.6100 38.6650
Columns 705 through 726
38.7200 38.7750 38.8300 38.8850 38.9400 38.9950 39.0500 39.1050 39.1600 39.2150 39.2700 39.3250 39.3800 39.4350 39.4900 39.5450 39.6000 39.6550 39.7100 39.7650 39.8200 39.8750
Columns 727 through 748
39.9300 39.9850 40.0400 40.0950 40.1500 40.2050 40.2600 40.3150 40.3700 40.4250 40.4800 40.5350 40.5900 40.6450 40.7000 40.7550 40.8100 40.8650 40.9200 40.9750 41.0300 41.0850
Columns 749 through 770
41.1400 41.1950 41.2500 41.3050 41.3600 41.4150 41.4700 41.5250 41.5800 41.6350 41.6900 41.7450 41.8000 41.8550 41.9100 41.9650 42.0200 42.0750 42.1300 42.1850 42.2400 42.2950
Columns 771 through 792
42.3500 42.4050 42.4600 42.5150 42.5700 42.6250 42.6800 42.7350 42.7900 42.8450 42.9000 42.9550 43.0100 43.0650 43.1200 43.1750 43.2300 43.2850 43.3400 43.3950 43.4500 43.5050
Columns 793 through 814
43.5600 43.6150 43.6700 43.7250 43.7800 43.8350 43.8900 43.9450 44.0000 44.0550 44.1100 44.1650 44.2200 44.2750 44.3300 44.3850 44.4400 44.4950 44.5500 44.6050 44.6600 44.7150
Columns 815 through 836
44.7700 44.8250 44.8800 44.9350 44.9900 45.0450 45.1000 45.1550 45.2100 45.2650 45.3200 45.3750 45.4300 45.4850 45.5400 45.5950 45.6500 45.7050 45.7600 45.8150 45.8700 45.9250
Columns 837 through 858
45.9800 46.0350 46.0900 46.1450 46.2000 46.2550 46.3100 46.3650 46.4200 46.4750 46.5300 46.5850 46.6400 46.6950 46.7500 46.8050 46.8600 46.9150 46.9700 47.0250 47.0800 47.1350
Columns 859 through 880
47.1900 47.2450 47.3000 47.3550 47.4100 47.4650 47.5200 47.5750 47.6300 47.6850 47.7400 47.7950 47.8500 47.9050 47.9600 48.0150 48.0700 48.1250 48.1800 48.2350 48.2900 48.3450
Columns 881 through 902
48.4000 48.4550 48.5100 48.5650 48.6200 48.6750 48.7300 48.7850 48.8400 48.8950 48.9500 49.0050 49.0600 49.1150 49.1700 49.2250 49.2800 49.3350 49.3900 49.4450 49.5000 49.5550
Columns 903 through 924
49.6100 49.6650 49.7200 49.7750 49.8300 49.8850 49.9400 49.9950 50.0500 50.1050 50.1600 50.2150 50.2700 50.3250 50.3800 50.4350 50.4900 50.5450 50.6000 50.6550 50.7100 50.7650
Columns 925 through 946
50.8200 50.8750 50.9300 50.9850 51.0400 51.0950 51.1500 51.2050 51.2600 51.3150 51.3700 51.4250 51.4800 51.5350 51.5900 51.6450 51.7000 51.7550 51.8100 51.8650 51.9200 51.9750
Columns 947 through 968
52.0300 52.0850 52.1400 52.1950 52.2500 52.3050 52.3600 52.4150 52.4700 52.5250 52.5800 52.6350 52.6900 52.7450 52.8000 52.8550 52.9100 52.9650 53.0200 53.0750 53.1300 53.1850
Columns 969 through 990
53.2400 53.2950 53.3500 53.4050 53.4600 53.5150 53.5700 53.6250 53.6800 53.7350 53.7900 53.8450 53.9000 53.9550 54.0100 54.0650 54.1200 54.1750 54.2300 54.2850 54.3400 54.3950
Columns 991 through 1,001
54.4500 54.5050 54.5600 54.6150 54.6700 54.7250 54.7800 54.8350 54.8900 54.9450 55.0000
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!发生错误
由于页面发生更改,无法完成操作。请重新加载页面以查看其更新后的状态。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
亚太
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)