How to shorten the amount of decimals?
9 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
Star Strider
on 20 May 2021
1 Comment
Steven Lord
on 20 May 2021
You can instead call vpa with two inputs if you don't want to affect the number of digits for future calls.
More Answers (0)
See Also
Categories
Find more on Mathematics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!