Question: need all parts in matlab Given the following function: function outstat = per(num) % Persistent variable sums the numbers persistent mysum if isempty(mysum) mysum=0 end




Given the following function: function outstat = per(num) % Persistent variable sums the numbers persistent mysum if isempty(mysum) mysum=0 end mysum = mysum + num; outstat = mysum; end What are the results for the first two times calling the function in command window( see below)? >per(4) ans =? >per(6) ans=? the answer for per(4) is 6 and the answer for per(6) is 6 the answer for per(4) is 10 and the answer for per(6) is 10 the answer for per(4) is 4 and the answer for per(6) is 4 the answer for per(4) is 4 and the answer for per(6) is 10 the answer for per(4) is 4 and the answer for per( 6 ) is 6 none of them Given the following code, answer the question. function [z,v]= getvals (x,y) z=x+y v=calcabs(x,y); end function v=calcabs(x,y) v=abs(xy) end In the Matlab command: >>[a,b]= getvals (4,6) Given the following function header: function doit(a,b) which of the following function calls would be valid? result=doit(2,3)doit(1,3,4)x=11;y=3.3;doit(x,y) fprintf('The result is \%.f`n', doit (4,11))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
