Why to use vpa instead of double in dealing with symbolic variables?
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Amit Kumar
il 29 Gen 2014
Risposto: Sean de Wolski
il 29 Gen 2014
Hello, I have a matrix in symbolic form and I want to convert it or display it as float. How to do this? Here is my simple code:
syms X Y
F=[(50*Y)/3 + 127/120, (50*X)/3 + 31/1000;54*Y - 319/600, 54*X + 917/1000];
double(F)
However matlab gives error for last line and I have to use vpa. I don't want to display F as having fractions, so I want to convert it to float. Anyone having any comments?
0 Commenti
Risposta accettata
Sean de Wolski
il 29 Gen 2014
For display
vpa(F,5)
You can't convert it to double because X and Y are symbolic. To convert it to double, you would first have to use subs to substitute values for X and Y.
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Numbers and Precision in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!