Why do I get these warnings when using the heaviside function?

Warning: Failed to initialize symbolic preferences. 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.
MATLAB takes a really long time to run whenever the heaviside function is used. Below is an example. I'm using MATLAB R2018a. I ran the same bit of code on the online MATLAB and it was fine. Run time was short and no warnings.
x=@(t) (t-1).*(t>=1)- 2.*heaviside(t-2) - (t-3).*(t>=3);
figure
fplot(x,[0,5])
grid;
xlabel('t')
ylabel('x(t)')

1 件のコメント

Walter Roberson
Walter Roberson 2018 年 7 月 7 日
Do you happen to be using Windows 10? If so have you updated your MATLAB R2018a to Update 3 at least?

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

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeGraph and Network Algorithms についてさらに検索

タグ

質問済み:

Amy
2018 年 7 月 7 日

コメント済み:

2018 年 7 月 7 日

Community Treasure Hunt

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

Start Hunting!

Translated by