In: Computer Science
Matlab: How would I write a script that calculates a. 654.23+345.73 b. 3984566/5.5 (need to use the format long command)
Code to write a script file named "calculate" in order to compute the result of given statements:
% script to calculate the given expression
% Use of 'format long' command
format long
disp(654.23 + 345.73);
disp(3984566/5.5);
Code for command window:
>> clear all
>> run calculate
9.999600000000000e+02
7.244665454545454e+05
>> % So the answer of (a) 9.999600000000000e+02
>> % And the answer of (b) 7.244665454545454e+05
Attached screenshot of the MatLab window for reference:
*NOTE: Drop comments for queries.