How to Reduce precision in symbolic calculations? I am finding y coordinates of a function using the given values of x, but i need a precision of only 6 digits whereas it is showing precision of upto 32 digits. Is there any way to reduce this.

1 次查看(过去 30 天)
I have written this code
F(x)=str2sym(input('\n Enter your Function \n','s'));
n=5;
for i=1:n
Xc(n-i+1)=cos((2*i-1)*pi/(2*n));
Yc(n-i+1)=F(Xc(n+1-i));
end
Output for Yc i am getting like this
464117984467495032381892722260990947504936973669843836644757151680908531146350992264046993107726927583732093218310834812684079069294231552/168985358144614903155245222233811487413573432092325201308884315904260130151775076057502118851573812559523911443976373100061575749702154875

采纳的回答

Ameer Hamza
Ameer Hamza 2020-11-20
You can use vpa()
vpa(Yc, 6)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Number Theory 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by