MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

# Solution 219993

Submitted on 21 Mar 2013 by Dan

Correct

10Size
`This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.`

### Test Suite

Test
Code Input and Output
1
Pass

```%%
%p = 4x^4 + 3x^3 + x + 19
x=[4 3 0 1 19]
y_correct = [16 9 0 1]
assert(isequal(your_fcn_name(x),y_correct))
```
```x =
4     3     0     1    19
y_correct =
16     9     0     1
```
2
Pass

```%%
%p = 5x^6 + 3x^4 + 8x^2 + 1
x=[5 0 3 0 8 0 1]
y_correct = [30     0    12     0    16     0]
assert(isequal(your_fcn_name(x),y_correct))
```
```x =
5     0     3     0     8     0     1
y_correct =
30     0    12     0    16     0
```
3
Pass

```%%
x=[[3 zeros(1,399) 15 zeros(1,100)]]
y_correct = [1500	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	1500	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0]
assert(isequal(your_fcn_name(x),y_correct))
```
```x =
Columns 1 through 16
3     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
Columns 17 through 32
0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
Columns 33 through 48
0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
Columns 49 through 64
0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
Columns 65 through 80
0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
Columns 81 through 96
0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
Columns 97 through 112
0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
Columns 113 through 128
0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
Columns 129 through 144
0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
Columns 145 through 160
0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
Columns 161 through 176
0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
Columns 177 through 192
0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
Columns 193 through 208
0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
Columns 209 through 224
0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
Columns 225 through 240
0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
Columns 241 through 256
0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
Columns 257 through 272
0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
Columns 273 through 288
0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
Columns 289 through 304
0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
Columns 305 through 320
0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
Columns 321 through 336
0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
Columns 337 through 352
0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
Columns 353 through 368
0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
Columns 369 through 384
0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
Columns 385 through 400
0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
Columns 401 through 416
15     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
Columns 417 through 432
0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
Columns 433 through 448
0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
Columns 449 through 464
0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
Columns 465 through 480
0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
Columns 481 through 496
0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
Columns 497 through 501
0     0     0     0     0
y_correct =
Columns 1 through 8
1500           0           0           0           0           0           0           0
Columns 9 through 16
0           0           0           0           0           0           0           0
Columns 17 through 24
0           0           0           0           0           0           0           0
Columns 25 through 32
0           0           0           0           0           0           0           0
Columns 33 through 40
0           0           0           0           0           0           0           0
Columns 41 through 48
0           0           0           0           0           0           0           0
Columns 49 through 56
0           0           0           0           0           0           0           0
Columns 57 through 64
0           0           0           0           0           0           0           0
Columns 65 through 72
0           0           0           0           0           0           0           0
Columns 73 through 80
0           0           0           0           0           0           0           0
Columns 81 through 88
0           0           0           0           0           0           0           0
Columns 89 through 96
0           0           0           0           0           0           0           0
Columns 97 through 104
0           0           0           0           0           0           0           0
Columns 105 through 112
0           0           0           0           0           0           0           0
Columns 113 through 120
0           0           0           0           0           0           0           0
Columns 121 through 128
0           0           0           0           0           0           0           0
Columns 129 through 136
0           0           0           0           0           0           0           0
Columns 137 through 144
0           0           0           0           0           0           0           0
Columns 145 through 152
0           0           0           0           0           0           0           0
Columns 153 through 160
0           0           0           0           0           0           0           0
Columns 161 through 168
0           0           0           0           0           0           0           0
Columns 169 through 176
0           0           0           0           0           0           0           0
Columns 177 through 184
0           0           0           0           0           0           0           0
Columns 185 through 192
0           0           0           0           0           0           0           0
Columns 193 through 200
0           0           0           0           0           0           0           0
Columns 201 through 208
0           0           0           0           0           0           0           0
Columns 209 through 216
0           0           0           0           0           0           0           0
Columns 217 through 224
0           0           0           0           0           0           0           0
Columns 225 through 232
0           0           0           0           0           0           0           0
Columns 233 through 240
0           0           0           0           0           0           0           0
Columns 241 through 248
0           0           0           0           0           0           0           0
Columns 249 through 256
0           0           0           0           0           0           0           0
Columns 257 through 264
0           0           0           0           0           0           0           0
Columns 265 through 272
0           0           0           0           0           0           0           0
Columns 273 through 280
0           0           0           0           0           0           0           0
Columns 281 through 288
0           0           0           0           0           0           0           0
Columns 289 through 296
0           0           0           0           0           0           0           0
Columns 297 through 304
0           0           0           0           0           0           0           0
Columns 305 through 312
0           0           0           0           0           0           0           0
Columns 313 through 320
0           0           0           0           0           0           0           0
Columns 321 through 328
0           0           0           0           0           0           0           0
Columns 329 through 336
0           0           0           0           0           0           0           0
Columns 337 through 344
0           0           0           0           0           0           0           0
Columns 345 through 352
0           0           0           0           0           0           0           0
Columns 353 through 360
0           0           0           0           0           0           0           0
Columns 361 through 368
0           0           0           0           0           0           0           0
Columns 369 through 376
0           0           0           0           0           0           0           0
Columns 377 through 384
0           0           0           0           0           0           0           0
Columns 385 through 392
0           0           0           0           0           0           0           0
Columns 393 through 400
0           0           0           0           0           0           0           0
Col...```
4
Pass

```%%
x=[1 -2 3 -4 -3 2 -1]
y_correct = [6   -10    12   -12    -6     2]
assert(isequal(your_fcn_name(x),y_correct))
```
```x =
1    -2     3    -4    -3     2    -1
y_correct =
6   -10    12   -12    -6     2
```