필터 지우기
필터 지우기

I can't get my function to work or print right

조회 수: 1 (최근 30일)
Brendan
Brendan 2023년 11월 8일
답변: Walter Roberson 2023년 11월 8일
x=(0:31);
y=(2.^x);
disp(y)
Im just trying to get a list of values from 2^0 to 2^31. I know the range is right but I guess theres something I don't understand about functions because the values are mostly below 1.

채택된 답변

Walter Roberson
Walter Roberson 2023년 11월 8일
The values are not below 1: you have been fooled by the way the default output format
x=(0:31);
y=(2.^x);
disp(y)
1.0e+09 * Columns 1 through 19 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0001 0.0001 0.0003 Columns 20 through 32 0.0005 0.0010 0.0021 0.0042 0.0084 0.0168 0.0336 0.0671 0.1342 0.2684 0.5369 1.0737 2.1475
format long g
disp(y)
Columns 1 through 7 1 2 4 8 16 32 64 Columns 8 through 14 128 256 512 1024 2048 4096 8192 Columns 15 through 21 16384 32768 65536 131072 262144 524288 1048576 Columns 22 through 28 2097152 4194304 8388608 16777216 33554432 67108864 134217728 Columns 29 through 32 268435456 536870912 1073741824 2147483648

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by