How to use feval in this code. I am getting this error: Argument must contain a string or function_handle.

3 ビュー (過去 30 日間)
syms t g
g= feval('f',((x(2)-x(1))*t+(x(1)+x(2)))/2) % g is now a function of t
a=w1*feval(g,x1)+w2*feval(g,x2)+w3*feval(g,x3)

回答 (1 件)

Walter Roberson
Walter Roberson 2016 年 2 月 22 日
syms f(t)
g = f( ((x(2)-x(1))*t+(x(1)+x(2)))/2 );
a = w1 * g(x1 + w2 * g(x2) + w3 * g(x3);
Note: this requires about R2011b onward. If you have an earlier version, please indicate which version it is as the capabilities changed a fair bit between R2008a and R2011a.
  1 件のコメント
Shubham Maurya
Shubham Maurya 2016 年 2 月 23 日
編集済み: Shubham Maurya 2016 年 2 月 23 日
No error is coming now, but value of h(0) is not evaluated
as =
(2001599859406885*h(0))/2251799813685248 + (5003999986287185*h(-3488473274374427/4503599627370496))/9007199254740992 + (5003999986287185*h(3488473274374427/4503599627370496))/9007199254740992
How to get numerical value of h(0) and have the final value of 'as' a number. By the way I have R2013a. Thanks

サインインしてコメントする。

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by