Error using fplot: Warning: Error updating FunctionLine.

Hi everyone,
I would like to plot the following function:
function ax_max = maxax(ay,v)
if (v <=130/3.6)
ax_max(ay <= 0.8) = -3.5;
ax_max(ay > 0.8 & ay <= 4.5) = -307/74 + 30/37*ay;
ax_max(ay > 4.5) = 0;
else
ax_max(ay < 0.5) = -2.5;
ax_max(ay >= 0.5 & ay <= 2.5) = -25/8 + 5/4*ay;
ax_max(ay > 2.5) = 0;
end
ax_max=abs(ax_max);
end
by using
fplot(@(ay) -maxax(ay, sqrt(30*ay)), [0 5])
I would like to create four subplots varying the number "30" fplot (30, 123, 400, 900). The fplot function works wenn using "900", but with for example "30"I just get an empty plot and the following warning:
"Warning: Error updatin Function Line. The following error was reported evaluating the function in FunctionLine update: In an assignment A(:) = B, the number of elements in A and B must be the same."
Thank you for your help!

1 件のコメント

Anurag Agarwal
Anurag Agarwal 2020 年 4 月 4 日
Sir,
Did you get the solution of it? If yes, please share.

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

回答 (2 件)

HUXIN GAO
HUXIN GAO 2018 年 10 月 28 日

0 投票

Hello! Recently I have encountered the same problem. Have you solved it? if done, could share it with me. Thanks very much!

2 件のコメント

madhan ravi
madhan ravi 2018 年 10 月 28 日
Ask a question separately @ Huxin with all the necessary details
Anurag Agarwal
Anurag Agarwal 2020 年 4 月 4 日
@Huxin Gao, did you get the solution? If yes, please share it.
Thank you

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

Walter Roberson
Walter Roberson 2020 年 4 月 4 日
編集済み: Walter Roberson 2020 年 4 月 4 日

0 投票

V = [30, 123, 400, 900];
nV = length(V);
for K = 1 : nV
subplot(1,nV,K)
fplot(@(ay) -maxax(ay, sqrt(V(K)*ay)), [0 5]);
title(sprintf('V = %f', V(K)));
end

カテゴリ

ヘルプ センター および File ExchangeLine Plots についてさらに検索

タグ

質問済み:

2018 年 2 月 21 日

編集済み:

2020 年 4 月 4 日

Community Treasure Hunt

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

Start Hunting!

Translated by