Problem with 'subs' function
Afficher commentaires plus anciens
Hi all,
I'm having a strange problem with the 'subs' function. Basically, func_A_test and func_j_test are symbolic functions of p_M. I want to evaluate them over a vector of p_M values from 0.005 to 0.007. When I substitute in 0.005 for p_M I get a different value than if I substitute the first value of the p_M vector (p_M_vec) which is also 0.005.
>> p_M_vec = [0.005:0.0005:0.007]
p_M_vec =
0.0050 0.0055 0.0060 0.0065 0.0070
>> subs(func_A_test,{p_M},{p_M_vec(1)})
ans =
486.1358
>> p_M_vec(1)
ans =
0.0050
>> subs(func_A_test,{p_M},{p_M_vec(1)})
ans =
486.1358
>> subs(func_j_test,{p_M},{p_M_vec(1)})
ans =
14.1930
>> subs(func_A_test,{p_M},{0.05})
ans =
48.3781
>> subs(func_j_test,{p_M},{0.05})
ans =
12.5569
Not sure why this is happening. Any help is greatly appreciated. I am very confused about this.
Thanks so much.
Regards, Rama
Réponses (1)
Walter Roberson
le 16 Jan 2012
0 votes
I do not see the problem in what you show.
Each time you substitute 0.005 (from whatever source) in to funcs_A_test, you get 486.1358 . When you substitute 0.05 instead to funcs_A_test, you get 48.3781 .
When you substitute 0.005 in to func_j_test, you get 14.1930. When you substitute 0.05 instead to funcs_j_test, you get 12.5569.
Perhaps you misread between 0.005 and 0.05 ?
Catégories
En savoir plus sur Evaluation dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!