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

조회 수: 1 (최근 30일)
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 CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by