how to make graph for this function

답변 (1개)

Setsuna Yuuki.
Setsuna Yuuki. 2020년 11월 15일
편집: Setsuna Yuuki. 2020년 11월 15일

0 개 추천

You can use fplot()
for example:
syms x;
y = @(x) abs(x-4)+abs(x^2-5*x+6)-abs(x+4)+4;
fplot(y,'LineWidth',3);
xlim([-6 12])
more info: https://es.mathworks.com/help/matlab/ref/fplot.html

댓글 수: 2

Eva
Eva 2020년 11월 15일
Thank you very much but it says this: "Warning: Function behaves unexpectedly on array inputs. To improve performance, properly vectorize your function to return an output with the same size and shape as the input
arguments.
> In matlab.graphics.function.FunctionLine>getFunction
In matlab.graphics.function/FunctionLine/updateFunction
In matlab.graphics.function.FunctionLine.set.Function_I
In matlab.graphics.internal.figfile.FigFile/read (line 31)
In matlab.graphics.internal.figfile.FigFile
In loadFigure (line 31)
In openfig>localOpenFigure (line 75)
In openfig (line 40)
In open (line 132)
In uiopen (line 159)" How to fix it, please?
I need to make graph+asymptotes
Setsuna Yuuki.
Setsuna Yuuki. 2020년 11월 15일
편집: Setsuna Yuuki. 2020년 11월 15일
Another way:
x = linspace(-6,12,2000);
y = abs(x-4)+abs(x.^2-5*x+6)-abs(x+4)+4;
plot(x,y,'LineWidth',2)

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Mathematics에 대해 자세히 알아보기

태그

질문:

Eva
2020년 11월 15일

편집:

2020년 11월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by