what is [1.511102307000000e+09;2.862954597000000e+09;991052076] in matlab

The expression [1.511102307000000e+09;2.862954597000000e+09;991052076] is a Matlab array (vector) with three elements. The exponential notation e+09 means that the number is multiplied by 10 to the power of 9. To assign this array to a variable, you can write:

main.m
myArray = [1.511102307000000e+09;2.862954597000000e+09;991052076];
67 chars
2 lines

You can access each element of the array using its index, like this:

main.m
firstElement = myArray(1); % 1.5111e+09
secondElement = myArray(2); % 2.8630e+09
thirdElement = myArray(3); % 991052076
120 chars
4 lines

You can also perform operations between arrays of the same size, like addition, subtraction, multiplication and division element-wise:

main.m
% Adding two arrays of the same size
sumArray = myArray + myArray; % [3.0222e+09; 5.7259e+09; 1982104152]

% Multiplying two arrays of the same size
mulArray = myArray .* myArray; % [2.2866e+18; 8.1939e+18; 9.8215e+17]
219 chars
6 lines

Note that the dot before the operator is necessary to perform element-wise operations. Without the dot, Matlab would try to perform matrix operations, which would raise an error because the dimensions don't match.

related categories

gistlibby LogSnag