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