fplot Warning: Function behaves unexpectedly on array inputs.

12 ビュー (過去 30 日間)
Emmanuel J Rodriguez
Emmanuel J Rodriguez 2021 年 8 月 17 日
コメント済み: Star Strider 2021 年 8 月 17 日
Hello! This SHOULD be a simple fix, and I've spent some time reading answers to similar question.... but still can't manage to find a fix. I'm trying to use fplot to plot lift as a function of length L.
% Lift load
syms q_l ka L x
q_l = ka.*sqrt(L.^2 - x.^2) % Expression for load distribution function
% Integrate expression over the length of wing to calc total load acting on
% wing due to lift
lift = int(q_l,0,L)
lift = subs(lift,ka,150)
% Plot lift as a function of wing length
fplot(@(L) lift,[10 20])
I get the following warnings (no curve is plotted):
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.
Warning: Error updating FunctionLine.
The following error was reported evaluating the function in FunctionLine update: Unable to convert expression into double array.

採用された回答

Star Strider
Star Strider 2021 年 8 月 17 日
The ‘lift’ funciton is symbolic, so no function handle is necessary to plot it with fplot. (If you want to create a funciton handle from it, use the matlabFunction function.)
% Lift load
syms q_l ka L x
q_l = ka.*sqrt(L.^2 - x.^2) % Expression for load distribution function
q_l = 
% Integrate expression over the length of wing to calc total load acting on
% wing due to lift
lift = int(q_l,0,L)
lift = 
lift = subs(lift,ka,150)
lift = 
% Plot lift as a function of wing length
fplot(lift,[10 20])
.
  2 件のコメント
Emmanuel J Rodriguez
Emmanuel J Rodriguez 2021 年 8 月 17 日
Star Strider
Star Strider 2021 年 8 月 17 日
As always, my pleasure!
.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAssumptions についてさらに検索

タグ

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by