Discover MakerZone

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

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 415941

Submitted on 9 Mar 2014 by andrea84

Correct

8Size
Leading solution size is 8.
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
 
%%
x = 230;
y = transformer(x);
y_correct = 115;
if ~isequal(y,y_correct)
disp('That is not correct!');
disp('��������������8���qBD�aZF$TW�F�H0��K���������������������');
disp('���������$�WçXw�/+�}{}��{�}pԿ*/&v&F��g�����������������');
disp('��������p��r�C/�n[**��"�_!*\"_^��7&�n/V2����H����������');
disp('����W�0�Ct�v����"�^���;:�-::�";^������(}(}{I�$�E�M�������');
disp('����P9{{{�{}��������,:::����'';::��;��*{}|�}��<t=��B������');
disp('�����j&�j{/����"_;;�;:�.������,�,''^^���"���{�{�46b�B�����');
disp('����KC�}��~��!^;:����������.�����:;::~~����{(*<}�I��K����');
disp('���M�wri��;'':''::��.�  ��  ���`��:;,,��,;�"���"_��{r��F���');
disp('�ƧT�{���":;,���``.��  � ������.����..`��:;__^�"�{i{zagW�');
disp('��ּl|��"��;�.���   � �   �������.�:_��`��:;_������}[ua�N');
disp('�ԩn/��""_,������    ���������.���:::-�;,::;^�*|{+}}}>J5F');
disp('�pIc}*���_:���`�   ��.��������.``���,;�;;;:;��"���}�}vI6�');
disp('�dc+�/}�"-:''�`��  �,`.��������������,:;_^-::'''';_�*��)t=Y�');
disp('�Au}������''�`��  ��''`.�.��������``���,;��~:��:;�;��{|�z��');
disp('�s{����_�;��������,''�`����������`���::;-��::'':���^�^���%p');
disp('���}����;:,������,:,,`���.����.�����'':�_"��,:::_��*��"�{Y');
disp('��L?}}*���''�``���::::��_*I}_�...`�,^[��\�{�;;_^�����{]l}}');
disp('�5]����{�^:_�^_,�::''�;::_~^~;;�`�;�){ti���;^+t�}*�}i\tc�');
disp('�S%�}}��I�^�"��;�::''�::�n�ʪ^~^�;(����Lz}*�;��sV�x{�/{?]');
disp('�Kg4{���}�;:_;�禲:''�,�:�:,:�~:;}-:;�����?{�ݾ5�5nt�ruz6');
disp('�k+����ii;,;���^�Ii���`���������''�*�:;__��C+��n%I�%j{tI��');
disp('�v��+{uu��;;:*>"lz{t_��������;�_�;{";::;-�=">��p�Zht�awD');
disp('j)��{rxͩi�^*_?��Y}c�:`.����''^{:����::-��}{�{}{Y�aYao���W');
disp('&l{{?Jn�z�����lf�C?�::�����:���:;{}:::��)JYjrYzADhZd�#��');
disp('L�l11�I�[�~~�~{�ʩ�*,::`.�'':��i����~^;��[���mz�G��Ӷ����');
disp('WD��{�u�v]�"^�����է/�::���CPEG���YCv�"}����������������');
disp('���zI[{{�"���*{z��ʧ�;�'':&I]tnu}ξn�{"�1������Ԯ��������');
disp('���K&I\*{*�*�{{����������;;�:;��^_�;-�}D�����������������');
disp('���#��x/il\t�ofb�������Mz?��;:����'';���I�����������������');
disp('��������M�d�Fs�������ʪ�����J�-;-_�u�V;M�����������������');
disp('�����������������������z��!3����M��� v������������������');
disp('�������������������������ֿ  �;����   �������������������');
disp('��������������������������ʷ  �*42/&b�^:�����������������');
disp('��������������������������:�-��������^  �����������������');
disp('��������������������������ʷ :������ʬ  P����������������');
disp('����������������������������   �������  W����������������');
disp('�����������������������������    {���ʲ �����������������');
disp('������������������������������   ������:�����������������');
disp('������������������������������g  ������������������������');
disp('�������������������������������8�g�����������������������');
disp('Is this problem a hair-raiser?');
end
assert(isequal(y,y_correct))
ans =
   115
2
Pass
 
%%
% On request of Ned Gulley, some extra testcases (for the, hopefully, stable voltage regulator within the input voltage range specified on the box).
assert(isequal(transformer(173),115))
assert(isequal(transformer(225),115))
assert(isequal(transformer(145),115))
assert(isequal(transformer(238),115))
assert(isequal(transformer(163),115))
assert(isequal(transformer(128),115))
assert(isequal(transformer(216),115))
assert(isequal(transformer(164),115))
assert(isequal(transformer(136),115))
assert(isequal(transformer(156),115))
assert(isequal(transformer(166),115))
assert(isequal(transformer(132),115))
assert(isequal(transformer(162),115))
assert(isequal(transformer(227),115))
assert(isequal(transformer(203),115))
assert(isequal(transformer(168),115))
assert(isequal(transformer(174),115))
assert(isequal(transformer(170),115))
assert(isequal(transformer(161),115))
assert(isequal(transformer(226),115))
assert(isequal(transformer(232),115))
assert(isequal(transformer(146),115))
assert(isequal(transformer(151),115))
assert(isequal(transformer(152),115))
assert(isequal(transformer(193),115))
assert(isequal(transformer(201),115))
assert(isequal(transformer(192),115))
assert(isequal(transformer(133),115))
assert(isequal(transformer(137),115))
assert(isequal(transformer(224),115))
assert(isequal(transformer(200),115))
assert(isequal(transformer(221),115))
assert(isequal(transformer(160),115))
assert(isequal(transformer(230),115))
assert(isequal(transformer(176),115))
assert(isequal(transformer(210),115))
assert(isequal(transformer(159),115))
assert(isequal(transformer(177),115))
assert(isequal(transformer(126),115))
assert(isequal(transformer(197),115))
assert(isequal(transformer(141),115))
assert(isequal(transformer(222),115))
assert(isequal(transformer(189),115))
assert(isequal(transformer(223),115))
assert(isequal(transformer(140),115))
assert(isequal(transformer(231),115))
assert(isequal(transformer(236),115))
assert(isequal(transformer(180),115))
assert(isequal(transformer(191),115))
assert(isequal(transformer(149),115))
assert(isequal(transformer(172),115))
assert(isequal(transformer(196),115))
assert(isequal(transformer(135),115))
assert(isequal(transformer(209),115))
assert(isequal(transformer(144),115))
assert(isequal(transformer(233),115))
assert(isequal(transformer(215),115))
assert(isequal(transformer(204),115))
assert(isequal(transformer(187),115))
assert(isequal(transformer(202),115))
assert(isequal(transformer(217),115))
assert(isequal(transformer(171),115))
assert(isequal(transformer(153),115))
assert(isequal(transformer(139),115))
assert(isequal(transformer(148),115))
assert(isequal(transformer(169),115))
assert(isequal(transformer(130),115))
assert(isequal(transformer(219),115))
assert(isequal(transformer(206),115))
assert(isequal(transformer(127),115))
assert(isequal(transformer(129),115))
assert(isequal(transformer(218),115))
assert(isequal(transformer(220),115))
assert(isequal(transformer(213),115))
assert(isequal(transformer(207),115))
assert(isequal(transformer(188),115))
assert(isequal(transformer(179),115))
assert(isequal(transformer(185),115))
assert(isequal(transformer(131),115))
assert(isequal(transformer(157),115))
assert(isequal(transformer(143),115))
assert(isequal(transformer(147),115))
assert(isequal(transformer(138),115))
assert(isequal(transformer(214),115))
assert(isequal(transformer(178),115))
assert(isequal(transformer(182),115))
assert(isequal(transformer(195),115))
assert(isequal(transformer(237),115))
assert(isequal(transformer(155),115))
assert(isequal(transformer(158),115))
assert(isequal(transformer(199),115))
assert(isequal(transformer(211),115))
assert(isequal(transformer(228),115))
assert(isequal(transformer(175),115))
assert(isequal(transformer(150),115))
assert(isequal(transformer(194),115))
assert(isequal(transformer(134),115))
assert(isequal(transformer(229),115))
assert(isequal(transformer(181),115))
assert(isequal(transformer(190),115))
assert(isequal(transformer(165),115))
assert(isequal(transformer(235),115))
assert(isequal(transformer(239),115))
assert(isequal(transformer(212),115))
assert(isequal(transformer(208),115))
assert(isequal(transformer(142),115))
assert(isequal(transformer(198),115))
assert(isequal(transformer(184),115))
assert(isequal(transformer(240),115))
assert(isequal(transformer(205),115))
assert(isequal(transformer(234),115))
assert(isequal(transformer(186),115))
assert(isequal(transformer(183),115))
assert(isequal(transformer(167),115))
assert(isequal(transformer(154),115))
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115
ans =
   115