Why won't a function handle plot?

1 回表示 (過去 30 日間)
K
K 2012 年 9 月 11 日
I have a long and complicated symbolic expression:
syms x
A=(60984*x)/(203125*exp((-(243936*x^4)/203125)^(1/4))*(-(243936*x^4)/203125)^(1/4)) + (((203125^(1/2)*19758816^(1/2)*(1/exp((203125^(3/4)*(-19758816)^(1/4)*i)/203125)))/(17563392*exp((203125^(3/4)*(-19758816)^(1/4))/203125))...etc (continues for another 25,000 char or so)
The expression is a function of x, and appears as a 1x1 symbol. I convert "A" to a function like so:
B=matlabFunction(A)
I would now like to plot B versus x for several values of x. I tried defining x and then using plot(x,B), but the error message says that conversion from double to sym is not possible. Can this be plotted? What am I missing?
Thank you! Kaitlin

採用された回答

Matt Fig
Matt Fig 2012 年 9 月 11 日
編集済み: Matt Fig 2012 年 9 月 11 日
When you make a function, you should use it like a function...
syms x
A = 3*x + 5*x^3;
B = matlabFunction(A);
x = 0:.1:10;
plot(x,B(x))
  1 件のコメント
K
K 2012 年 9 月 12 日
Thank you!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeConversion Between Symbolic and Numeric についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by