필터 지우기
필터 지우기

Error Using fplot for plotting a function

조회 수: 4 (최근 30일)
Teoman Selcuk
Teoman Selcuk 2021년 11월 1일
댓글: Walter Roberson 2021년 11월 1일
Without setting a xlim how would i be able to plot the function y according to its domain (-∞, 1]. I get an error whilst plotting the graph and the plot function prints the invalid params D: (-∞,∞) hencewhy I want to use the fplot function.
x = [-1.5:0.01:1.5];
y= -sqrt((1-x))+nthroot(x.^2,5);
fplot(x, y);
Error:
Error using fplot (line 149)
Invalid parameter '-0.4050...'.

채택된 답변

Walter Roberson
Walter Roberson 2021년 11월 1일
fplot() can be used for:
  1. symbolic expressions
  2. symbolic functions
  3. function handles
fplot() cannot be used for numeric vectors. You should use plot() for numeric vectors.
  댓글 수: 1
Walter Roberson
Walter Roberson 2021년 11월 1일
x = [-1.5:0.001:1.5];
y = -sqrt((1-x))+nthroot(x.^2,5);
mask = imag(y) ~= 0 | real(y) > 1;
y(mask) = nan;
plot(x, y);

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by