USING MATLAB ONLY PLEASE COMMENT CODE IN DETAIL SHOW OUTPU

USING MATLAB ONLY - PLEASE COMMENT CODE IN DETAIL & SHOW OUTPUT

Write an M-File.

First define the values:

x = 6.2 double precision

y = 3.14 single precision

index = 50 32-bit unsigned integer

points = -21 64-bit signed integer

Now display the following lines of data using the fprintf function:

x = 6.2

6.20 3.14

50

index = 50, \'%\\%\\%\', points = -21

Solution

main.m

clc;
close all;
clear all;
%matlab automatocally define the values as double precision, single
%precision, 32-bit unsigned integer and 64-bit signed integer
x = 6.2;
y = 3.14;
index = 50;
points = -21;

fprintf(\'x = %.1f\ \',x)             %print double precision
fprintf(\'%.2f %.2f\ \',x,y)         %print single precision
fprintf(\'%u\ \',index)               %print 32-bit unsigned integer
fprintf(\'index = %u,\',index)        %print 32-bit unsigned integer
fprintf(\'%%\\\\%%\\\\%%, points = %d\',points)   %print 64-bit signed integer

Output :

x = 6.2
6.20 3.14
50
index = 50,%\\%\\%, points = -21

USING MATLAB ONLY - PLEASE COMMENT CODE IN DETAIL & SHOW OUTPUT Write an M-File. First define the values: x = 6.2 double precision y = 3.14 single precision

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site