Question: Consider the following function. (a) What would be the response to the call fun with no arguments? (b) Rewrite it (the function and default x)

 Consider the following function. (a) What would be the response to

Consider the following function. (a) What would be the response to the call fun with no arguments? (b) Rewrite it (the function and default x) so that it evaluates post fix notation expressions that are formed as nested cell arrays. function [t] = fun(x) if nargin == 0 x = { '+' { '-' { '*' 9 2 } 5} { '/' 18 6 } } }: end if iscell(x) switch x(1) case '+' t = fun (x{2}) + fun (x{3}): case '-' t = fun (x{2}) - fun (x{3}): case '*' t = fun(x{2}) * fun (x{3}): case '/' t = fun (x{2})/fun (x{3}): end else t = x: end

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!