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.

4 views (last 30 days)
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

Accepted Answer

Ameer Hamza
Ameer Hamza on 20 Nov 2020
You can use vpa()
vpa(Yc, 6)

More Answers (0)

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!