timeMeasured=[0 0.5 1 1.5 2]
timeMeasured =
0 0.5000 1.0000 1.5000 2.0000
TempMeasured=[8.42 4.86 2.8 1.62]
TempMeasured =
8.4200 4.8600 2.8000 1.6200
TempExactFun=@(t) 14.6*exp(-1.1*t)
TempExactFun =
function_handle with value:
@(t)14.6*exp(-1.1*t)
TempExacFun(1.5)
{Undefined function or variable 'TempExacFun'.}
TempExacTFun(1.5)
{Undefined function or variable 'TempExacTFun'.}
TempExactFun(1.5)
ans =
2.8039
timePlot=linspace(0,2,301)
timePlot =
Columns 1 through 5
0 0.0067 0.0133 0.0200 0.0267
Columns 6 through 10
0.0333 0.0400 0.0467 0.0533 0.0600
Columns 11 through 15
0.0667 0.0733 0.0800 0.0867 0.0933
Columns 16 through 20
0.1000 0.1067 0.1133 0.1200 0.1267
Columns 21 through 25
0.1333 0.1400 0.1467 0.1533 0.1600
Columns 26 through 30
0.1667 0.1733 0.1800 0.1867 0.1933
Columns 31 through 35
0.2000 0.2067 0.2133 0.2200 0.2267
Columns 36 through 40
0.2333 0.2400 0.2467 0.2533 0.2600
Columns 41 through 45
0.2667 0.2733 0.2800 0.2867 0.2933
Columns 46 through 50
0.3000 0.3067 0.3133 0.3200 0.3267
Columns 51 through 55
0.3333 0.3400 0.3467 0.3533 0.3600
Columns 56 through 60
0.3667 0.3733 0.3800 0.3867 0.3933
Columns 61 through 65
0.4000 0.4067 0.4133 0.4200 0.4267
Columns 66 through 70
0.4333 0.4400 0.4467 0.4533 0.4600
Columns 71 through 75
0.4667 0.4733 0.4800 0.4867 0.4933
Columns 76 through 80
0.5000 0.5067 0.5133 0.5200 0.5267
Columns 81 through 85
0.5333 0.5400 0.5467 0.5533 0.5600
Columns 86 through 90
0.5667 0.5733 0.5800 0.5867 0.5933
Columns 91 through 95
0.6000 0.6067 0.6133 0.6200 0.6267
Columns 96 through 100
0.6333 0.6400 0.6467 0.6533 0.6600
Columns 101 through 105
0.6667 0.6733 0.6800 0.6867 0.6933
Columns 106 through 110
0.7000 0.7067 0.7133 0.7200 0.7267
Columns 111 through 115
0.7333 0.7400 0.7467 0.7533 0.7600
Columns 116 through 120
0.7667 0.7733 0.7800 0.7867 0.7933
Columns 121 through 125
0.8000 0.8067 0.8133 0.8200 0.8267
Columns 126 through 130
0.8333 0.8400 0.8467 0.8533 0.8600
Columns 131 through 135
0.8667 0.8733 0.8800 0.8867 0.8933
Columns 136 through 140
0.9000 0.9067 0.9133 0.9200 0.9267
Columns 141 through 145
0.9333 0.9400 0.9467 0.9533 0.9600
Columns 146 through 150
0.9667 0.9733 0.9800 0.9867 0.9933
Columns 151 through 155
1.0000 1.0067 1.0133 1.0200 1.0267
Columns 156 through 160
1.0333 1.0400 1.0467 1.0533 1.0600
Columns 161 through 165
1.0667 1.0733 1.0800 1.0867 1.0933
Columns 166 through 170
1.1000 1.1067 1.1133 1.1200 1.1267
Columns 171 through 175
1.1333 1.1400 1.1467 1.1533 1.1600
Columns 176 through 180
1.1667 1.1733 1.1800 1.1867 1.1933
Columns 181 through 185
1.2000 1.2067 1.2133 1.2200 1.2267
Columns 186 through 190
1.2333 1.2400 1.2467 1.2533 1.2600
Columns 191 through 195
1.2667 1.2733 1.2800 1.2867 1.2933
Columns 196 through 200
1.3000 1.3067 1.3133 1.3200 1.3267
Columns 201 through 205
1.3333 1.3400 1.3467 1.3533 1.3600
Columns 206 through 210
1.3667 1.3733 1.3800 1.3867 1.3933
Columns 211 through 215
1.4000 1.4067 1.4133 1.4200 1.4267
Columns 216 through 220
1.4333 1.4400 1.4467 1.4533 1.4600
Columns 221 through 225
1.4667 1.4733 1.4800 1.4867 1.4933
Columns 226 through 230
1.5000 1.5067 1.5133 1.5200 1.5267
Columns 231 through 235
1.5333 1.5400 1.5467 1.5533 1.5600
Columns 236 through 240
1.5667 1.5733 1.5800 1.5867 1.5933
Columns 241 through 245
1.6000 1.6067 1.6133 1.6200 1.6267
Columns 246 through 250
1.6333 1.6400 1.6467 1.6533 1.6600
Columns 251 through 255
1.6667 1.6733 1.6800 1.6867 1.6933
Columns 256 through 260
1.7000 1.7067 1.7133 1.7200 1.7267
Columns 261 through 265
1.7333 1.7400 1.7467 1.7533 1.7600
Columns 266 through 270
1.7667 1.7733 1.7800 1.7867 1.7933
Columns 271 through 275
1.8000 1.8067 1.8133 1.8200 1.8267
Columns 276 through 280
1.8333 1.8400 1.8467 1.8533 1.8600
Columns 281 through 285
1.8667 1.8733 1.8800 1.8867 1.8933
Columns 286 through 290
1.9000 1.9067 1.9133 1.9200 1.9267
Columns 291 through 295
1.9333 1.9400 1.9467 1.9533 1.9600
Columns 296 through 300
1.9667 1.9733 1.9800 1.9867 1.9933
Column 301
2.0000
TempExactPlot=TempExactFun(timePlot)
TempExactPlot =
Columns 1 through 5
14.6000 14.4933 14.3874 14.2823 14.1780
Columns 6 through 10
14.0744 13.9715 13.8694 13.7681 13.6675
Columns 11 through 15
13.5676 13.4685 13.3701 13.2724 13.1754
Columns 16 through 20
13.0792 12.9836 12.8888 12.7946 12.7011
Columns 21 through 25
12.6083 12.5162 12.4247 12.3339 12.2438
Columns 26 through 30
12.1544 12.0656 11.9774 11.8899 11.8030
Columns 31 through 35
11.7168 11.6312 11.5462 11.4618 11.3781
Columns 36 through 40
11.2949 11.2124 11.1305 11.0492 10.9684
Columns 41 through 45
10.8883 10.8087 10.7298 10.6514 10.5735
Columns 46 through 50
10.4963 10.4196 10.3435 10.2679 10.1929
Columns 51 through 55
10.1184 10.0445 9.9711 9.8982 9.8259
Columns 56 through 60
9.7541 9.6828 9.6121 9.5419 9.4721
Columns 61 through 65
9.4029 9.3342 9.2660 9.1983 9.1311
Columns 66 through 70
9.0644 8.9982 8.9324 8.8672 8.8024
Columns 71 through 75
8.7381 8.6742 8.6108 8.5479 8.4855
Columns 76 through 80
8.4235 8.3619 8.3008 8.2402 8.1800
Columns 81 through 85
8.1202 8.0609 8.0020 7.9435 7.8855
Columns 86 through 90
7.8279 7.7707 7.7139 7.6575 7.6016
Columns 91 through 95
7.5460 7.4909 7.4362 7.3818 7.3279
Columns 96 through 100
7.2744 7.2212 7.1684 7.1161 7.0641
Columns 101 through 105
7.0125 6.9612 6.9104 6.8599 6.8097
Columns 106 through 110
6.7600 6.7106 6.6616 6.6129 6.5646
Columns 111 through 115
6.5166 6.4690 6.4217 6.3748 6.3282
Columns 116 through 120
6.2820 6.2361 6.1905 6.1453 6.1004
Columns 121 through 125
6.0558 6.0116 5.9677 5.9241 5.8808
Columns 126 through 130
5.8378 5.7952 5.7528 5.7108 5.6690
Columns 131 through 135
5.6276 5.5865 5.5457 5.5052 5.4649
Columns 136 through 140
5.4250 5.3854 5.3460 5.3070 5.2682
Columns 141 through 145
5.2297 5.1915 5.1536 5.1159 5.0785
Columns 146 through 150
5.0414 5.0046 4.9680 4.9317 4.8957
Columns 151 through 155
4.8599 4.8244 4.7892 4.7542 4.7194
Columns 156 through 160
4.6849 4.6507 4.6167 4.5830 4.5495
Columns 161 through 165
4.5163 4.4833 4.4505 4.4180 4.3857
Columns 166 through 170
4.3537 4.3219 4.2903 4.2589 4.2278
Columns 171 through 175
4.1969 4.1663 4.1358 4.1056 4.0756
Columns 176 through 180
4.0458 4.0163 3.9869 3.9578 3.9289
Columns 181 through 185
3.9002 3.8717 3.8434 3.8153 3.7874
Columns 186 through 190
3.7598 3.7323 3.7050 3.6779 3.6511
Columns 191 through 195
3.6244 3.5979 3.5716 3.5455 3.5196
Columns 196 through 200
3.4939 3.4684 3.4430 3.4179 3.3929
Columns 201 through 205
3.3681 3.3435 3.3191 3.2948 3.2708
Columns 206 through 210
3.2469 3.2231 3.1996 3.1762 3.1530
Columns 211 through 215
3.1300 3.1071 3.0844 3.0619 3.0395
Columns 216 through 220
3.0173 2.9952 2.9733 2.9516 2.9301
Columns 221 through 225
2.9086 2.8874 2.8663 2.8454 2.8246
Columns 226 through 230
2.8039 2.7834 2.7631 2.7429 2.7229
Columns 231 through 235
2.7030 2.6832 2.6636 2.6442 2.6248
Columns 236 through 240
2.6057 2.5866 2.5677 2.5490 2.5303
Columns 241 through 245
2.5119 2.4935 2.4753 2.4572 2.4392
Columns 246 through 250
2.4214 2.4037 2.3862 2.3687 2.3514
Columns 251 through 255
2.3342 2.3172 2.3003 2.2835 2.2668
Columns 256 through 260
2.2502 2.2338 2.2174 2.2012 2.1852
Columns 261 through 265
2.1692 2.1533 2.1376 2.1220 2.1065
Columns 266 through 270
2.0911 2.0758 2.0607 2.0456 2.0306
Columns 271 through 275
2.0158 2.0011 1.9865 1.9719 1.9575
Columns 276 through 280
1.9432 1.9290 1.9149 1.9010 1.8871
Columns 281 through 285
1.8733 1.8596 1.8460 1.8325 1.8191
Columns 286 through 290
1.8058 1.7926 1.7795 1.7665 1.7536
Columns 291 through 295
1.7408 1.7281 1.7155 1.7029 1.6905
Columns 296 through 300
1.6781 1.6659 1.6537 1.6416 1.6296
Column 301
1.6177
plot(timeMeasured,TempMeasured,'ok',timePlot,TempExactPlot,'--k')
{Error using plot
Vectors must be the same length.}
TempExactPlot=TempExactFun(timePlot)
TempExactPlot =
Columns 1 through 5
14.6000 14.4933 14.3874 14.2823 14.1780
Columns 6 through 10
14.0744 13.9715 13.8694 13.7681 13.6675
Columns 11 through 15
13.5676 13.4685 13.3701 13.2724 13.1754
Columns 16 through 20
13.0792 12.9836 12.8888 12.7946 12.7011
Columns 21 through 25
12.6083 12.5162 12.4247 12.3339 12.2438
Columns 26 through 30
12.1544 12.0656 11.9774 11.8899 11.8030
Columns 31 through 35
11.7168 11.6312 11.5462 11.4618 11.3781
Columns 36 through 40
11.2949 11.2124 11.1305 11.0492 10.9684
Columns 41 through 45
10.8883 10.8087 10.7298 10.6514 10.5735
Columns 46 through 50
10.4963 10.4196 10.3435 10.2679 10.1929
Columns 51 through 55
10.1184 10.0445 9.9711 9.8982 9.8259
Columns 56 through 60
9.7541 9.6828 9.6121 9.5419 9.4721
Columns 61 through 65
9.4029 9.3342 9.2660 9.1983 9.1311
Columns 66 through 70
9.0644 8.9982 8.9324 8.8672 8.8024
Columns 71 through 75
8.7381 8.6742 8.6108 8.5479 8.4855
Columns 76 through 80
8.4235 8.3619 8.3008 8.2402 8.1800
Columns 81 through 85
8.1202 8.0609 8.0020 7.9435 7.8855
Columns 86 through 90
7.8279 7.7707 7.7139 7.6575 7.6016
Columns 91 through 95
7.5460 7.4909 7.4362 7.3818 7.3279
Columns 96 through 100
7.2744 7.2212 7.1684 7.1161 7.0641
Columns 101 through 105
7.0125 6.9612 6.9104 6.8599 6.8097
Columns 106 through 110
6.7600 6.7106 6.6616 6.6129 6.5646
Columns 111 through 115
6.5166 6.4690 6.4217 6.3748 6.3282
Columns 116 through 120
6.2820 6.2361 6.1905 6.1453 6.1004
Columns 121 through 125
6.0558 6.0116 5.9677 5.9241 5.8808
Columns 126 through 130
5.8378 5.7952 5.7528 5.7108 5.6690
Columns 131 through 135
5.6276 5.5865 5.5457 5.5052 5.4649
Columns 136 through 140
5.4250 5.3854 5.3460 5.3070 5.2682
Columns 141 through 145
5.2297 5.1915 5.1536 5.1159 5.0785
Columns 146 through 150
5.0414 5.0046 4.9680 4.9317 4.8957
Columns 151 through 155
4.8599 4.8244 4.7892 4.7542 4.7194
Columns 156 through 160
4.6849 4.6507 4.6167 4.5830 4.5495
Columns 161 through 165
4.5163 4.4833 4.4505 4.4180 4.3857
Columns 166 through 170
4.3537 4.3219 4.2903 4.2589 4.2278
Columns 171 through 175
4.1969 4.1663 4.1358 4.1056 4.0756
Columns 176 through 180
4.0458 4.0163 3.9869 3.9578 3.9289
Columns 181 through 185
3.9002 3.8717 3.8434 3.8153 3.7874
Columns 186 through 190
3.7598 3.7323 3.7050 3.6779 3.6511
Columns 191 through 195
3.6244 3.5979 3.5716 3.5455 3.5196
Columns 196 through 200
3.4939 3.4684 3.4430 3.4179 3.3929
Columns 201 through 205
3.3681 3.3435 3.3191 3.2948 3.2708
Columns 206 through 210
3.2469 3.2231 3.1996 3.1762 3.1530
Columns 211 through 215
3.1300 3.1071 3.0844 3.0619 3.0395
Columns 216 through 220
3.0173 2.9952 2.9733 2.9516 2.9301
Columns 221 through 225
2.9086 2.8874 2.8663 2.8454 2.8246
Columns 226 through 230
2.8039 2.7834 2.7631 2.7429 2.7229
Columns 231 through 235
2.7030 2.6832 2.6636 2.6442 2.6248
Columns 236 through 240
2.6057 2.5866 2.5677 2.5490 2.5303
Columns 241 through 245
2.5119 2.4935 2.4753 2.4572 2.4392
Columns 246 through 250
2.4214 2.4037 2.3862 2.3687 2.3514
Columns 251 through 255
2.3342 2.3172 2.3003 2.2835 2.2668
Columns 256 through 260
2.2502 2.2338 2.2174 2.2012 2.1852
Columns 261 through 265
2.1692 2.1533 2.1376 2.1220 2.1065
Columns 266 through 270
2.0911 2.0758 2.0607 2.0456 2.0306
Columns 271 through 275
2.0158 2.0011 1.9865 1.9719 1.9575
Columns 276 through 280
1.9432 1.9290 1.9149 1.9010 1.8871
Columns 281 through 285
1.8733 1.8596 1.8460 1.8325 1.8191
Columns 286 through 290
1.8058 1.7926 1.7795 1.7665 1.7536
Columns 291 through 295
1.7408 1.7281 1.7155 1.7029 1.6905
Columns 296 through 300
1.6781 1.6659 1.6537 1.6416 1.6296
Column 301
1.6177
plot(timeMeasured,TempMeasured,'ok',timePlot,TempExactPlot,'--k')
{Error using plot
Vectors must be the same length.}
TempMeasured
TempMeasured =
8.4200 4.8600 2.8000 1.6200
TempMeasured=[14.6 8.42 4.86 2.8 1.62]
TempMeasured =
14.6000 8.4200 4.8600 2.8000 1.6200
plot(timeMeasured,TempMeasured,'ok',timePlot,TempExactPlot,'--k')
timeDesired=0.7
timeDesired =
0.7000
TempLinear=interp1(timeMeasured,TempMeasured,timeDesired)
TempLinear =
6.9960
TempExact=TempExactFun(timeDesired)
TempExact =
6.7600
error=abs(TempLinear-TempExact)
error =
0.2360
TempSpline=spline(timeMeasured,TempMeasured,timeDesired)
TempSpline =
6.7513
error=abs(TempSpline-TempExact)
error =
0.0087
TempLinearPlot=interp1(timeMeasured,TempMeasured,timePlot)
TempLinearPlot =
Columns 1 through 5
14.6000 14.5176 14.4352 14.3528 14.2704
Columns 6 through 10
14.1880 14.1056 14.0232 13.9408 13.8584
Columns 11 through 15
13.7760 13.6936 13.6112 13.5288 13.4464
Columns 16 through 20
13.3640 13.2816 13.1992 13.1168 13.0344
Columns 21 through 25
12.9520 12.8696 12.7872 12.7048 12.6224
Columns 26 through 30
12.5400 12.4576 12.3752 12.2928 12.2104
Columns 31 through 35
12.1280 12.0456 11.9632 11.8808 11.7984
Columns 36 through 40
11.7160 11.6336 11.5512 11.4688 11.3864
Columns 41 through 45
11.3040 11.2216 11.1392 11.0568 10.9744
Columns 46 through 50
10.8920 10.8096 10.7272 10.6448 10.5624
Columns 51 through 55
10.4800 10.3976 10.3152 10.2328 10.1504
Columns 56 through 60
10.0680 9.9856 9.9032 9.8208 9.7384
Columns 61 through 65
9.6560 9.5736 9.4912 9.4088 9.3264
Columns 66 through 70
9.2440 9.1616 9.0792 8.9968 8.9144
Columns 71 through 75
8.8320 8.7496 8.6672 8.5848 8.5024
Columns 76 through 80
8.4200 8.3725 8.3251 8.2776 8.2301
Columns 81 through 85
8.1827 8.1352 8.0877 8.0403 7.9928
Columns 86 through 90
7.9453 7.8979 7.8504 7.8029 7.7555
Columns 91 through 95
7.7080 7.6605 7.6131 7.5656 7.5181
Columns 96 through 100
7.4707 7.4232 7.3757 7.3283 7.2808
Columns 101 through 105
7.2333 7.1859 7.1384 7.0909 7.0435
Columns 106 through 110
6.9960 6.9485 6.9011 6.8536 6.8061
Columns 111 through 115
6.7587 6.7112 6.6637 6.6163 6.5688
Columns 116 through 120
6.5213 6.4739 6.4264 6.3789 6.3315
Columns 121 through 125
6.2840 6.2365 6.1891 6.1416 6.0941
Columns 126 through 130
6.0467 5.9992 5.9517 5.9043 5.8568
Columns 131 through 135
5.8093 5.7619 5.7144 5.6669 5.6195
Columns 136 through 140
5.5720 5.5245 5.4771 5.4296 5.3821
Columns 141 through 145
5.3347 5.2872 5.2397 5.1923 5.1448
Columns 146 through 150
5.0973 5.0499 5.0024 4.9549 4.9075
Columns 151 through 155
4.8600 4.8325 4.8051 4.7776 4.7501
Columns 156 through 160
4.7227 4.6952 4.6677 4.6403 4.6128
Columns 161 through 165
4.5853 4.5579 4.5304 4.5029 4.4755
Columns 166 through 170
4.4480 4.4205 4.3931 4.3656 4.3381
Columns 171 through 175
4.3107 4.2832 4.2557 4.2283 4.2008
Columns 176 through 180
4.1733 4.1459 4.1184 4.0909 4.0635
Columns 181 through 185
4.0360 4.0085 3.9811 3.9536 3.9261
Columns 186 through 190
3.8987 3.8712 3.8437 3.8163 3.7888
Columns 191 through 195
3.7613 3.7339 3.7064 3.6789 3.6515
Columns 196 through 200
3.6240 3.5965 3.5691 3.5416 3.5141
Columns 201 through 205
3.4867 3.4592 3.4317 3.4043 3.3768
Columns 206 through 210
3.3493 3.3219 3.2944 3.2669 3.2395
Columns 211 through 215
3.2120 3.1845 3.1571 3.1296 3.1021
Columns 216 through 220
3.0747 3.0472 3.0197 2.9923 2.9648
Columns 221 through 225
2.9373 2.9099 2.8824 2.8549 2.8275
Columns 226 through 230
2.8000 2.7843 2.7685 2.7528 2.7371
Columns 231 through 235
2.7213 2.7056 2.6899 2.6741 2.6584
Columns 236 through 240
2.6427 2.6269 2.6112 2.5955 2.5797
Columns 241 through 245
2.5640 2.5483 2.5325 2.5168 2.5011
Columns 246 through 250
2.4853 2.4696 2.4539 2.4381 2.4224
Columns 251 through 255
2.4067 2.3909 2.3752 2.3595 2.3437
Columns 256 through 260
2.3280 2.3123 2.2965 2.2808 2.2651
Columns 261 through 265
2.2493 2.2336 2.2179 2.2021 2.1864
Columns 266 through 270
2.1707 2.1549 2.1392 2.1235 2.1077
Columns 271 through 275
2.0920 2.0763 2.0605 2.0448 2.0291
Columns 276 through 280
2.0133 1.9976 1.9819 1.9661 1.9504
Columns 281 through 285
1.9347 1.9189 1.9032 1.8875 1.8717
Columns 286 through 290
1.8560 1.8403 1.8245 1.8088 1.7931
Columns 291 through 295
1.7773 1.7616 1.7459 1.7301 1.7144
Columns 296 through 300
1.6987 1.6829 1.6672 1.6515 1.6357
Column 301
1.6200
TempSplinePlot=spline(timeMeasured,TempMeasured,timePlot)
TempSplinePlot =
Columns 1 through 5
14.6000 14.4949 14.3906 14.2869 14.1839
Columns 6 through 10
14.0815 13.9799 13.8789 13.7785 13.6789
Columns 11 through 15
13.5799 13.4815 13.3838 13.2868 13.1904
Columns 16 through 20
13.0946 12.9995 12.9051 12.8112 12.7180
Columns 21 through 25
12.6255 12.5336 12.4422 12.3516 12.2615
Columns 26 through 30
12.1720 12.0832 11.9950 11.9074 11.8203
Columns 31 through 35
11.7339 11.6481 11.5629 11.4783 11.3942
Columns 36 through 40
11.3108 11.2279 11.1456 11.0639 10.9828
Columns 41 through 45
10.9022 10.8222 10.7428 10.6639 10.5856
Columns 46 through 50
10.5079 10.4307 10.3540 10.2780 10.2024
Columns 51 through 55
10.1274 10.0529 9.9790 9.9056 9.8328
Columns 56 through 60
9.7604 9.6886 9.6173 9.5466 9.4763
Columns 61 through 65
9.4066 9.3373 9.2686 9.2004 9.1327
Columns 66 through 70
9.0654 8.9987 8.9325 8.8667 8.8015
Columns 71 through 75
8.7367 8.6724 8.6086 8.5453 8.4824
Columns 76 through 80
8.4200 8.3581 8.2966 8.2356 8.1750
Columns 81 through 85
8.1149 8.0553 7.9961 7.9373 7.8790
Columns 86 through 90
7.8211 7.7637 7.7067 7.6501 7.5940
Columns 91 through 95
7.5382 7.4829 7.4281 7.3736 7.3195
Columns 96 through 100
7.2659 7.2126 7.1598 7.1074 7.0553
Columns 101 through 105
7.0037 6.9525 6.9016 6.8511 6.8010
Columns 106 through 110
6.7513 6.7020 6.6530 6.6044 6.5562
Columns 111 through 115
6.5084 6.4609 6.4137 6.3670 6.3205
Columns 116 through 120
6.2745 6.2288 6.1834 6.1383 6.0936
Columns 121 through 125
6.0493 6.0053 5.9616 5.9182 5.8751
Columns 126 through 130
5.8324 5.7900 5.7479 5.7061 5.6647
Columns 131 through 135
5.6235 5.5826 5.5421 5.5018 5.4618
Columns 136 through 140
5.4222 5.3828 5.3437 5.3048 5.2663
Columns 141 through 145
5.2280 5.1901 5.1523 5.1149 5.0777
Columns 146 through 150
5.0408 5.0041 4.9677 4.9316 4.8957
Columns 151 through 155
4.8600 4.8246 4.7894 4.7545 4.7198
Columns 156 through 160
4.6854 4.6512 4.6172 4.5835 4.5500
Columns 161 through 165
4.5167 4.4837 4.4509 4.4183 4.3860
Columns 166 through 170
4.3538 4.3220 4.2903 4.2589 4.2276
Columns 171 through 175
4.1967 4.1659 4.1353 4.1050 4.0749
Columns 176 through 180
4.0450 4.0153 3.9859 3.9566 3.9276
Columns 181 through 185
3.8987 3.8701 3.8417 3.8135 3.7855
Columns 186 through 190
3.7577 3.7301 3.7027 3.6755 3.6485
Columns 191 through 195
3.6217 3.5951 3.5687 3.5425 3.5165
Columns 196 through 200
3.4907 3.4651 3.4396 3.4144 3.3893
Columns 201 through 205
3.3644 3.3398 3.3153 3.2909 3.2668
Columns 206 through 210
3.2429 3.2191 3.1955 3.1721 3.1488
Columns 211 through 215
3.1258 3.1029 3.0801 3.0576 3.0352
Columns 216 through 220
3.0130 2.9910 2.9691 2.9474 2.9259
Columns 221 through 225
2.9045 2.8833 2.8622 2.8413 2.8206
Columns 226 through 230
2.8000 2.7796 2.7593 2.7392 2.7192
Columns 231 through 235
2.6994 2.6798 2.6603 2.6409 2.6217
Columns 236 through 240
2.6026 2.5837 2.5649 2.5463 2.5278
Columns 241 through 245
2.5094 2.4912 2.4731 2.4552 2.4374
Columns 246 through 250
2.4197 2.4022 2.3848 2.3675 2.3504
Columns 251 through 255
2.3333 2.3164 2.2997 2.2830 2.2665
Columns 256 through 260
2.2501 2.2338 2.2177 2.2017 2.1857
Columns 261 through 265
2.1699 2.1543 2.1387 2.1232 2.1079
Columns 266 through 270
2.0926 2.0775 2.0625 2.0476 2.0328
Columns 271 through 275
2.0181 2.0035 1.9890 1.9746 1.9603
Columns 276 through 280
1.9461 1.9320 1.9180 1.9041 1.8903
Columns 281 through 285
1.8766 1.8630 1.8494 1.8360 1.8226
Columns 286 through 290
1.8094 1.7962 1.7831 1.7701 1.7571
Columns 291 through 295
1.7443 1.7315 1.7188 1.7062 1.6937
Columns 296 through 300
1.6812 1.6688 1.6565 1.6443 1.6321
Column 301
1.6200
plot(timeMeasured,TempMeasured,'ok',timePlot,TempExactPlot,'--k',timePlot,TempLinearPlot,'b',timePlot,TempSplinePlot,'r')
errLinearMax=max(abs(TempLinearPlot-TempExactPlot))
errLinearMax =
0.4212
errSplineMax=max(abs(TempSplinePlot-TempExactPlot))
errSplineMax =
0.0177
timeDesired=3
timeDesired =
3
TempLinear=interp1(timeMeasured,TempMeasured,timeDesired)
TempLinear =
NaN
TempLinear=interp1(timeMeasured,TempMeasured,timeDesired,'linear','extrap')
TempLinear =
-0.7400
TempSpline=spline(timeMeasured,TempMeasured,timeDesired)
TempSpline =
-0.0800
TempExact=TempExactFun(timeDesired)
TempExact =
0.5385
timeMeasuredN=linspace(0,2,40)
timeMeasuredN =
Columns 1 through 5
0 0.0513 0.1026 0.1538 0.2051
Columns 6 through 10
0.2564 0.3077 0.3590 0.4103 0.4615
Columns 11 through 15
0.5128 0.5641 0.6154 0.6667 0.7179
Columns 16 through 20
0.7692 0.8205 0.8718 0.9231 0.9744
Columns 21 through 25
1.0256 1.0769 1.1282 1.1795 1.2308
Columns 26 through 30
1.2821 1.3333 1.3846 1.4359 1.4872
Columns 31 through 35
1.5385 1.5897 1.6410 1.6923 1.7436
Columns 36 through 40
1.7949 1.8462 1.8974 1.9487 2.0000
rng(default)
{Undefined function or variable 'default'.}
rng('default')
randNums=randn(size(timeMeasuredN))
randNums =
Columns 1 through 5
0.5377 1.8339 -2.2588 0.8622 0.3188
Columns 6 through 10
-1.3077 -0.4336 0.3426 3.5784 2.7694
Columns 11 through 15
-1.3499 3.0349 0.7254 -0.0631 0.7147
Columns 16 through 20
-0.2050 -0.1241 1.4897 1.4090 1.4172
Columns 21 through 25
0.6715 -1.2075 0.7172 1.6302 0.4889
Columns 26 through 30
1.0347 0.7269 -0.3034 0.2939 -0.7873
Columns 31 through 35
0.8884 -1.1471 -1.0689 -0.8095 -2.9443
Columns 36 through 40
1.4384 0.3252 -0.7549 1.3703 -1.7115
TempMeasuredN=TempExactFun(timeMeasuredN)+randNums*0.5
TempMeasuredN =
Columns 1 through 5
14.8688 14.7162 11.9129 12.7581 11.8102
Columns 6 through 10
10.3580 10.1911 10.0083 11.0866 10.1722
Columns 11 through 15
7.6306 9.3674 7.7821 6.9809 6.9852
Columns 16 through 20
6.1618 5.8586 6.3408 5.9936 5.7075
Columns 21 through 25
5.0605 3.8619 4.5793 4.8043 4.0148
Columns 26 through 30
4.0809 3.7316 3.0317 3.1557 2.4501
Columns 31 through 35
3.1320 1.9668 1.8666 1.8646 0.6727
Columns 36 through 40
2.7464 2.0786 1.4335 2.3968 0.7620
timeDesired=0.7
timeDesired =
0.7000
TempLinear=interp1(timeMeasured,TempMeasured,timeDesired)
TempLinear =
6.9960
TempSpline=spline(timeMeasured,TempMeasured,timeDesired)
TempSpline =
6.7513
TempSpline=spline(timeMeasuredN,TempMeasuredN,timeDesired)
TempSpline =
7.0433
TempLinear=interp1(timeMeasuredN,TempMeasuredN,timeDesired)
TempLinear =
6.9837
TempLinearNPlot=interp1(timeMeasuredN,TempMeasuredN,timePlot)
TempLinearNPlot =
Columns 1 through 5
14.8688 14.8490 14.8291 14.8093 14.7894
Columns 6 through 10
14.7696 14.7497 14.7299 14.6040 14.2396
Columns 11 through 15
13.8752 13.5108 13.1463 12.7819 12.4175
Columns 16 through 20
12.0531 11.9805 12.0904 12.2003 12.3101
Columns 21 through 25
12.4200 12.5299 12.6397 12.7496 12.6443
Columns 26 through 30
12.5211 12.3979 12.2747 12.1515 12.0282
Columns 31 through 35
11.9050 11.7667 11.5779 11.3891 11.2003
Columns 36 through 40
11.0115 10.8227 10.6339 10.4451 10.3463
Columns 41 through 45
10.3246 10.3029 10.2812 10.2595 10.2378
Columns 46 through 50
10.2161 10.1944 10.1709 10.1472 10.1234
Columns 51 through 55
10.0997 10.0759 10.0522 10.0284 10.0299
Columns 56 through 60
10.1701 10.3102 10.4504 10.5906 10.7308
Columns 61 through 65
10.8710 11.0112 11.0318 10.9129 10.7940
Columns 66 through 70
10.6751 10.5563 10.4374 10.3185 10.1996
Columns 71 through 75
9.9180 9.5876 9.2572 8.9268 8.5964
Columns 76 through 80
8.2660 7.9356 7.6479 7.8737 8.0995
Columns 81 through 85
8.3253 8.5511 8.7769 9.0027 9.2285
Columns 86 through 90
9.2882 9.0821 8.8760 8.6699 8.4638
Columns 91 through 95
8.2577 8.0516 7.8455 7.7100 7.6058
Columns 96 through 100
7.5017 7.3975 7.2934 7.1892 7.0851
Columns 101 through 105
6.9809 6.9815 6.9820 6.9826 6.9832
Columns 106 through 110
6.9837 6.9843 6.9848 6.9523 6.8452
Columns 111 through 115
6.7382 6.6312 6.5241 6.4171 6.3100
Columns 116 through 120
6.2030 6.1376 6.0982 6.0587 6.0193
Columns 121 through 125
5.9799 5.9405 5.9011 5.8617 5.9165
Columns 126 through 130
5.9792 6.0419 6.1046 6.1672 6.2299
Columns 131 through 135
6.2926 6.3304 6.2853 6.2401 6.1950
Columns 136 through 140
6.1498 6.1047 6.0595 6.0144 5.9735
Columns 141 through 145
5.9364 5.8992 5.8620 5.8248 5.7876
Columns 146 through 150
5.7504 5.7133 5.6364 5.5523 5.4681
Columns 151 through 155
5.3840 5.2999 5.2158 5.1317 5.0365
Columns 156 through 160
4.8807 4.7249 4.5691 4.4132 4.2574
Columns 161 through 165
4.1016 3.9458 3.9049 3.9982 4.0914
Columns 166 through 170
4.1847 4.2780 4.3712 4.4645 4.5578
Columns 171 through 175
4.6018 4.6310 4.6603 4.6895 4.7188
Columns 176 through 180
4.7480 4.7773 4.7964 4.6938 4.5911
Columns 181 through 185
4.4885 4.3859 4.2832 4.1806 4.0780
Columns 186 through 190
4.0181 4.0267 4.0353 4.0439 4.0525
Columns 191 through 195
4.0611 4.0697 4.0783 4.0495 4.0041
Columns 196 through 200
3.9586 3.9132 3.8678 3.8224 3.7770
Columns 201 through 205
3.7316 3.6406 3.5496 3.4586 3.3676
Columns 206 through 210
3.2766 3.1856 3.0947 3.0366 3.0528
Columns 211 through 215
3.0689 3.0850 3.1011 3.1173 3.1334
Columns 216 through 220
3.1495 3.0993 3.0075 2.9158 2.8241
Columns 221 through 225
2.7324 2.6406 2.5489 2.4572 2.5319
Columns 226 through 230
2.6206 2.7092 2.7979 2.8865 2.9751
Columns 231 through 235
3.0638 3.0970 2.9455 2.7941 2.6426
Columns 236 through 240
2.4911 2.3397 2.1882 2.0367 1.9598
Columns 241 through 245
1.9468 1.9337 1.9207 1.9077 1.8946
Columns 246 through 250
1.8816 1.8686 1.8664 1.8661 1.8658
Columns 251 through 255
1.8656 1.8653 1.8651 1.8648 1.8407
Columns 256 through 260
1.6858 1.5309 1.3759 1.2210 1.0660
Columns 261 through 265
0.9111 0.7561 0.7971 1.0667 1.3363
Columns 266 through 270
1.6059 1.8755 2.1450 2.4146 2.6842
Columns 271 through 275
2.6796 2.5928 2.5060 2.4192 2.3324
Columns 276 through 280
2.2456 2.1588 2.0722 1.9883 1.9044
Columns 281 through 285
1.8206 1.7367 1.6528 1.5690 1.4851
Columns 286 through 290
1.4816 1.6069 1.7321 1.8573 1.9825
Columns 291 through 295
2.1078 2.2330 2.3582 2.2496 2.0371
Columns 296 through 300
1.8246 1.6121 1.3995 1.1870 0.9745
Column 301
0.7620
TempSplineNPlot=spline(timeMeasuredN,TempMeasuredN,timePlot)
TempSplineNPlot =
Columns 1 through 5
14.8688 15.3477 15.6363 15.7564 15.7296
Columns 6 through 10
15.5777 15.3225 14.9857 14.5890 14.1543
Columns 11 through 15
13.7032 13.2574 12.8388 12.4691 12.1700
Columns 16 through 20
11.9632 11.8687 11.8805 11.9731 12.1211
Columns 21 through 25
12.2987 12.4802 12.6399 12.7521 12.7958
Columns 26 through 30
12.7730 12.6928 12.5646 12.3977 12.2013
Columns 31 through 35
11.9848 11.7573 11.5270 11.2998 11.0812
Columns 36 through 40
10.8769 10.6924 10.5333 10.4051 10.3132
Columns 41 through 45
10.2559 10.2254 10.2137 10.2128 10.2148
Columns 46 through 50
10.2116 10.1952 10.1594 10.1091 10.0534
Columns 51 through 55
10.0018 9.9633 9.9474 9.9632 10.0201
Columns 56 through 60
10.1218 10.2582 10.4172 10.5865 10.7538
Columns 61 through 65
10.9069 11.0336 11.1219 11.1636 11.1554
Columns 66 through 70
11.0940 10.9762 10.7989 10.5587 10.2526
Columns 71 through 75
9.8797 9.4599 9.0230 8.5991 8.2179
Columns 76 through 80
7.9094 7.7036 7.6303 7.7052 7.8987
Columns 81 through 85
8.1722 8.4871 8.8047 9.0864 9.2936
Columns 86 through 90
9.3884 9.3581 9.2247 9.0124 8.7457
Columns 91 through 95
8.4488 8.1462 7.8620 7.6192 7.4234
Columns 96 through 100
7.2701 7.1548 7.0729 7.0196 6.9905
Columns 101 through 105
6.9809 6.9861 7.0005 7.0186 7.0347
Columns 106 through 110
7.0433 7.0387 7.0153 6.9676 6.8939
Columns 111 through 115
6.7992 6.6890 6.5688 6.4441 6.3206
Columns 116 through 120
6.2038 6.0990 6.0093 5.9358 5.8799
Columns 121 through 125
5.8427 5.8254 5.8294 5.8557 5.9045
Columns 126 through 130
5.9706 6.0472 6.1272 6.2038 6.2701
Columns 131 through 135
6.3192 6.3441 6.3416 6.3160 6.2724
Columns 136 through 140
6.2160 6.1518 6.0850 6.0209 5.9642
Columns 141 through 145
5.9166 5.8760 5.8407 5.8086 5.7779
Columns 146 through 150
5.7467 5.7131 5.6749 5.6295 5.5738
Columns 151 through 155
5.5048 5.4195 5.3148 5.1878 5.0353
Columns 156 through 160
4.8581 4.6662 4.4711 4.2844 4.1176
Columns 161 through 165
3.9822 3.8898 3.8515 3.8684 3.9306
Columns 166 through 170
4.0275 4.1486 4.2833 4.4211 4.5514
Columns 171 through 175
4.6644 4.7561 4.8255 4.8713 4.8927
Columns 176 through 180
4.8884 4.8575 4.7988 4.7131 4.6072
Columns 181 through 185
4.4892 4.3670 4.2485 4.1419 4.0550
Columns 186 through 190
3.9957 3.9662 3.9608 3.9732 3.9972
Columns 191 through 195
4.0266 4.0551 4.0767 4.0853 4.0789
Columns 196 through 200
4.0575 4.0214 3.9705 3.9052 3.8255
Columns 201 through 205
3.7316 3.6246 3.5100 3.3944 3.2843
Columns 206 through 210
3.1860 3.1063 3.0515 3.0282 3.0365
Columns 211 through 215
3.0669 3.1086 3.1509 3.1830 3.1943
Columns 216 through 220
3.1741 3.1127 3.0141 2.8925 2.7626
Columns 221 through 225
2.6387 2.5355 2.4675 2.4491 2.4905
Columns 226 through 230
2.5805 2.7010 2.8338 2.9608 3.0639
Columns 231 through 235
3.1249 3.1260 3.0590 2.9368 2.7747
Columns 236 through 240
2.5880 2.3920 2.2020 2.0333 1.9006
Columns 241 through 245
1.8088 1.7534 1.7296 1.7329 1.7583
Columns 246 through 250
1.8013 1.8572 1.9206 1.9837 2.0372
Columns 251 through 255
2.0720 2.0788 2.0486 1.9722 1.8403
Columns 256 through 260
1.6525 1.4296 1.1962 0.9766 0.7953
Columns 261 through 265
0.6767 0.6451 0.7241 0.9127 1.1824
Columns 266 through 270
1.5035 1.8462 2.1807 2.4774 2.7063
Columns 271 through 275
2.8413 2.8839 2.8495 2.7537 2.6118
Columns 276 through 280
2.4393 2.2518 2.0646 1.8909 1.7365
Columns 281 through 285
1.6058 1.5031 1.4328 1.3991 1.4066
Columns 286 through 290
1.4593 1.5549 1.6820 1.8286 1.9829
Columns 291 through 295
2.1329 2.2665 2.3719 2.4370 2.4500
Columns 296 through 300
2.3988 2.2715 2.0561 1.7407 1.3133
Column 301
0.7620
plot(timeMeasuredN,TempMeasuredN,'ok',timePlot,TempExactPlot,'--k',timePlot,TempLinearNPlot,'b',timePlot,TempSplineNPlot,'r')
errSplineNMax=max(abs(TempSplineNPlot-TempExactNPlot))
{Undefined function or variable 'TempExactNPlot'.}
errSplineNMax=max(abs(TempSplineNPlot-TempExactPlot))
errSplineNMax =
2.0296
errLinearNMax=max(abs(TempLinearNPlot-TempExactPlot))
errLinearNMax =
1.7657
% save our work space
save lecture4
clear
load lecture4