Question: Used in Matlab. This is the code that was given to get a screen display in the command window. Write the screen display for the

Used in Matlab.

This is the code that was given to get a screen display in the command window.

Write the screen display for the following script and associated functions in the space provided. Credit only given for work shown.

% script

x=17;

y=20;

z = [71 25 14 90 16];

fori = 1:2:5

if(i <= 2)

back1= fcn1(i,x,y,z)

elseif(i > 3)

disp('done')

else

back2= fcn2(i,y,x,z)

end

end

%%functions:

function[out2] = fcn1(j,y,x,k)

out2= [0 0 0 0 0]

fori=1:3:5

out2(i) = fcn2(i,x,y,k);

end

function[out1] = fcn2(j,d,s,k)

switch(k(j))

case{1,2}

out1= d+9

case{3,4}

out1= 2*s

otherwise

out1= d+s

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!