フィルターのクリア

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 Center および File ExchangeCalculus についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by