Do I need symbolic math toolbox to graph a function such as f(x)=ln(x) or f(x, y)=y^2/x

4 ビュー (過去 30 日間)
Emilia
Emilia 2015 年 11 月 7 日
回答済み: John BG 2017 年 3 月 10 日
I just bought matlab and while processing data works well I cannot find how to graph functions from R to R for instance. Is it the case that I need to buy symbolic math toolbox in order to be able to do these graphings?

採用された回答

Stephen23
Stephen23 2015 年 11 月 7 日
編集済み: Stephen23 2015 年 11 月 7 日
There is no need for the symbolic toolbox for such simple functions. Try this:
>> X = 0:0.1:3;
>> Y = log(X);
>> plot(X,Y)
Or your second example:
>> [X,Y] = meshgrid(0:0.1:2,1:5);
>> Z = Y.^2./X;
>> surf(X,Y,Z)
  3 件のコメント
Stephen23
Stephen23 2015 年 11 月 7 日
編集済み: Stephen23 2015 年 11 月 8 日
You pick those numbers to suit your needs: what range do you want to plot, and with how many points? The introductory tutorials describe how to make vectors of values:
And for more detailed info:
Tip use your favorite internet search engine to search the MATLAB documentation. Half of the questions we answer here are solved by simply reading the documentation.
Walter Roberson
Walter Roberson 2015 年 11 月 8 日
Additionally:
If you had an expression in symbolic form because you were using the Symbolic toolbox, then you would still need to select particular ranges to plot it over. The plot routines cannot plot symbolic expressions directly: they can only plot the results of substituting in particular values into symbolic expressions and by so doing getting a numeric result.
You may also wish to look at ezplot()

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

その他の回答 (1 件)

John BG
John BG 2017 年 3 月 10 日
Hi Emilia
if it's about just plotting a function, there is a new function that does not require the symbolic Tool box called fplot
fplot(@(x) log10(x))
.
the same applies to fsurf, no need for the previous mesh declaration
fsurf(@(x,y) sin(x)+cos(y),'lines','none')
.
'
the field lines=none is optional
mesh also has a new fmesh
if you find this answer useful would you please be so kind to mark my answer as Accepted Answer?
To any other reader, please if you find this answer of any help solving your question,
please click on the thumbs-up vote link,
thanks in advance
John BG

カテゴリ

Help Center および File ExchangeSymbolic Math Toolbox についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by