A number in matlab by default uses how much memory?

In summary, the conversation is about determining how much memory a number in MATLAB uses. The speaker shares that they assigned a random number and found that it required 8 bytes of memory according to the "whos" command. However, this was not one of the options given in the multiple choice question, which included options such as 64 bits, 8 bits if it has no decimal, and 4 megabytes. The speaker is seeking clarification and advice on the problem.
  • #1
gpax42
25
0
A number in MATLAB by default uses how much memory?

my professor asked me this question today and I wasnt sure.

In MATLAB I assigned a random number to the variable x

>> x = 5.5623

and then used the "whos" command to determine how many bytes were stored. According to "whos", the number required 8 bytes of memory.

However, 8 wasnt part of the multiple choice.

the multiple choice were...

a. 64 bits
b. Depends on its length
c. 8 bits if it has no decimal, 32 bits if it has a decimal
d. 4 megabytes

could any1 shine some light on this problem for me, any advice would be much appreciated:smile:
 
Physics news on Phys.org
  • #2
Please don't double post. See my answer in the Homework section.
 

1. How much memory does a number in Matlab use by default?

A number in Matlab uses 8 bytes of memory by default.

2. Is it possible to change the default memory usage for numbers in Matlab?

Yes, it is possible to change the default memory usage for numbers in Matlab by using the format command to specify a different data type or precision.

3. How does the memory usage for numbers in Matlab compare to other programming languages?

The default memory usage for numbers in Matlab is generally higher than other programming languages due to its use of double-precision floating point numbers.

4. Can I reduce the memory usage for numbers in Matlab?

Yes, you can reduce the memory usage for numbers in Matlab by using single-precision floating point numbers or by using integers instead.

5. Does the size of a number in Matlab affect its memory usage?

Yes, the size of a number in Matlab directly affects its memory usage. Larger numbers will require more memory than smaller numbers.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
11K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
940
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
8
Views
1K
  • Programming and Computer Science
Replies
3
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
2K
Back
Top