필터 지우기
필터 지우기

decimal in wrong position when dividing a 1x10 column by single variable.

조회 수: 2 (최근 30일)
Matthew
Matthew 2023년 8월 31일
편집: Torsten 2023년 8월 31일
F = [0;1650;3400;5200;6850;7750;8150;8500;8750;9000];
A = (0.4/2)^2 * pi();
sigma = F/A
sigma = 10×1
1.0e+04 * 0 1.3130 2.7056 4.1380 5.4511 6.1673 6.4856 6.7641 6.9630 7.1620
% my problem occures when i divide F/A. The decimal place is shifted over 4 positions to the left
% the answers are the same, just the decimal place is off.
  댓글 수: 1
Torsten
Torsten 2023년 8월 31일
편집: Torsten 2023년 8월 31일
You see the 1.0e+04 above with which the values in the column have to be multiplied ? Or what is your question ?

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2023년 8월 31일
format long g
F = [0;1650;3400;5200;6850;7750;8150;8500;8750;9000];
A = (0.4/2)^2 * pi();
sigma = F/A
sigma = 10×1
1.0e+00 * 0 13130.2828050814 27056.3403256222 41380.2852038928 54510.5680089742 61672.5404481094 64855.6393099473 67640.8508140555 69630.2876027042 71619.7243913529
The answers were not wrong: you were just overlooking the 1.0e+04 * just before the numbers. When you use the (default) format short then if you have numbers above about 100 or below about 0.01 in the mix, then the result will be show in scientific notation with a common factor shown at the top.

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by