eval() returns NaN when my matrix gets really big.
Mostra commenti meno recenti
Hi
Im making a model of a mass-spring system where I can increase the numbers of masses. I use modal analysis where I transform my eq's into the Q domain and then back again.
My final result is a [n,1] vector where n is the numbers of masses.
When I use:
n = 4 % Number os masses %
T = 1 % Time which is set as "syms T" %
eval(X) % X is my [n,1] vector %
my result is something like:
ans =
0.0158
0.0739
0.1778
0.8150
but when I pick n to be more then 4 i just get "NaN" and I think it is because my vector gets too big for eval()..
When I look at my X vector it looks like this:
(227072026347336273211456024361092029598452603947709420093308928000*sin(T))/3496036292367407553353910200384804229923697463840499539488117510161+..... and it continues likes this for 2 full pages.
What to do?
Thank you!
Risposta accettata
Più risposte (1)
Mads
il 25 Apr 2012
0 voti
4 Commenti
Mads
il 25 Apr 2012
Alexander
il 25 Apr 2012
Strange, I would have expected Walters suggestion to be much faster but give the NaN answer. Good to know, that both works.
Walter Roberson
il 25 Apr 2012
If T is a vector then you would need 'T=[' num2str(T) ']'
Alexander
il 25 Apr 2012
Yeah, you are right. My suggestion does not work for vectors, I did not think about that.
Categorie
Scopri di più su Logical in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!