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 vue (au cours des 30 derniers jours)
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

Réponse acceptée

Ameer Hamza
Ameer Hamza le 20 Nov 2020
You can use vpa()
vpa(Yc, 6)
  2 commentaires
Harsh Mittal
Harsh Mittal le 20 Nov 2020
does this works for symbolic functions with variable 'x', because i am further using value of Yc in calculations?

Connectez-vous pour commenter.

Plus de réponses (0)

Produits


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by