how to stem an expression function in discrete manner as using fplot to evaluate expression function in continuous manner?
10 ビュー (過去 30 日間)
古いコメントを表示
I can use fplot to plot an expression, which means I can plot the function without specify the range of dependent variable. For example, >>syms x; fplot(heaviside(x),[-4, 4]); It plots the continous function heaviside and show plots from range [-4 4]. Now, supposedly I want an discrete sample of such plot how do I do it ?
For example, I tried: >>syms x; stem(heaviside(x),[-4,4]); ==> but matlab cannot using stem function to evaluate the expression function.
I know that I can do: >> x=-10:10; stem(heaviside(x),[-4,4]); ==> matlab will plot this, but it is not what I want, I want it to be ploted in the discrete manner without specifying "x=-10:10". In other words, I want an function expression to be evaluated in the way that stem function does to an definite function. Or to say if there is a discrete plot/stem function for an expression function like fplot for continuous expression function?
Thank you very much!
0 件のコメント
回答 (1 件)
Walter Roberson
2017 年 3 月 17 日
編集済み: Walter Roberson
2017 年 3 月 17 日
You can pass a function handle to fplot. You can use matlabFunction to create function handles from symbolic expressions.
However, not all symbolic expressions can be converted. If the expression makes use of a symbolic function that there is no corresponding numeric function for, such as piecewise, then it might not be able to do the conversion.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Assumptions についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!