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

# Solution 210536

Submitted on 28 Feb 2013 by Muthu Annamalai

Correct

180Size
`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

```z = rand(2,1)*10;
val = rpn(z(1),z(2),'/')
assert( val == z(2)/z(1) )
z = rand(2,1)*10;
val = rpn(z(1),z(2),'%')
assert( val == mod(z(2),z(1)) )
z = rand(2,1)*10;
val = rpn(z(1),z(2),'/')
assert( val == z(2)/z(1) )
z = rand(2,1)*10;
val = rpn(z(1),z(2),'-')
assert( val == (z(1)-z(2)) )
z = rand(2,1)*10;
val = rpn(z(1),z(2),'+')
assert( val == (z(1)+z(2)) )
z = rand(2,1)*10;
val = rpn(3,4,'-',5,'+')
assert( val == eval('3 - 4 + 5') )
val = rpn(5,1,2,'+',4,'*','+',3,'-')
assert( val == eval('5 + ((1+2)*4) - 3') )
val = rpn(55,11,22,'+',44,'*','+',33,'-')
assert( val == eval('55 + ((11+22)*44) - 33') )
val = rpn(553,112,221,'+',440,'*','+',30,'-')
assert( val == eval('553 + ((112+221)*440) - 30') )
val = rpn(553,112,221,'+',440,'*','+',30,'-')
assert( val == eval('553 + ((112+221)*440) - 30') )
%z = ceil(rand(1,5)*50);
%z = [1,2,3,4,5];
%val = rpn(z(1),'+',z(2),'*',z(1),z(3),'-',z(4),z(5),'%','*')
%q = mod( z(5),z(4))*(((z(1)+z(2))*z(1))-z(3))
%assert( val == q )
```
```val =
0.9504
val =
1.5898
val =
0.2673
val =
-8.7107
val =
2.0372
val =
4
val =
14
val =
1474
val =
147043
val =
147043
```