How to shorten the amount of decimals?
6 ビュー (過去 30 日間)
古いコメントを表示
I keep getting really long numerical values as output:
An =
0.024234995896557227359496464702679*alpha
0.15943782393832228295849338860996*alpha
-0.12536421301907562828842055676579*alpha
-0.03553313448766475646513348990721*alpha
-0.13243736773001789371670675334921*alpha
-1.1264101534225156844164497805098*alpha
0.032972016135334102699585911872833*alpha
0.10090249826183501633095025194958*alpha
0.094800519200094255394106279895626*alpha
-0.031355837620080097288391753550103*alpha
How can i reduce this to only a couple decimal places?
Entire code for reference:
clc
clear
N = 19;
AR = 6;
n =1:2:N;
b = 6;
Vinf = 1;
c = 1;
deltay = b./(N+1);
y0n = -(b./2)+n.*deltay;
syms alpha
A = sym('A', [1, N]);
A = A(1:2:end);
Pi = sym(pi);
theta = (linspace((Pi/6),(Pi/2),numel(n)).');
S1 = sum(A.*sin(n.*(theta)));
S2 = sum(n.*A.*(sin(n.*(theta))./sin((theta))));
eq1 = (2*AR/pi)*S1+S2 == alpha;
[A,b] = equationsToMatrix(eq1, A);
x = linsolve (A,b);
An = vpa(x)
0 件のコメント
採用された回答
Star Strider
2021 年 5 月 20 日
1 件のコメント
Steven Lord
2021 年 5 月 20 日
You can instead call vpa with two inputs if you don't want to affect the number of digits for future calls.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Mathematics についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!