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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started