# Name 2 8 marks total consider the matlab function

• Test Prep
• 9
• 100% (10) 10 out of 10 people found this document helpful

This preview shows page 3 - 6 out of 9 pages.

Name:2.(8 marks total)Consider theMatlabfunction contained in the filefunc1.m.function [z,zx,zy] = func1(x,y)% [z,zx,zy] = func1(x,y)zx=0; zy=0;for j = x:yz=x+y; zx=zx+j; zy=x+j;if (j==(x+y)/2), break, end;end(a) What values ofZ,Zx, andZyare returned by the following function invocation?
(b) What values ofZ,Zx, andZyare returned by the following function invocation?
Name:3.(4 marks total)Convert the following numbers to decimal (i.e., base 10) numbers.Write your answers to at least three digits using the round-to-nearest rule.Use normalised scientific notation with the leading nonzero digit to the right of thedecimal point, i.e., in the form (0.d1d2. . . dt)10×10ewhereeis a suitable exponent,the precisiont= 6, andd16= 0 is the leading nonzero digit.(a) (110)2(b) (0.101)2×2-14.(2 marks total)Consider a binary floating-point number system characterised by precisiont= 4 and exponents betweenemin=-4 andemax= 3.(a) What is the smallest normalised positive machine number (in binary form)?(b) What is the largest normalised positive machine number (in binary form)?
Name:5.(1 mark)Is the following statement always true (T) or at least sometimes false (F)? Con-
• • • 