Why is my plot blank ?

>> syms y
>> syms U
>> A=(-U-U*exp(-y))./(exp(-y)-1)
A =
-(U + U*exp(-y))/(exp(-y) - 1)
>> B=(2*U)./(exp(-y)-1)
B =
(2*U)/(exp(-y) - 1)
>> f(U,y)= A+B*exp(-y)
f(U, y) =
(2*U*exp(-y))/(exp(-y) - 1) - (U + U*exp(-y))/(exp(-y) - 1)
>> plot(f(U,0.01),f(U,100))
Error using plot
Data must be numeric, datetime, duration or an array convertible to double.
((Trying to plot two versions of the function. One with y=0.01 and y=100.))

3 件のコメント

David Hill
David Hill 2019 年 12 月 3 日
What is U? You will need to vary U to be able to plot it.
Rik
Rik 2019 年 12 月 3 日
I'm on mobile so I can't test it, but you probably need to divide this into 2 calls to plot. And is there a reason why you're using symbolic variables instead of anonymous functions (and fplot)?
Blake Walkowiak
Blake Walkowiak 2019 年 12 月 3 日
U represents a velocity, when I define U,
>> U=1
I still do not have a plot. When I use the fplot command I get a straight y=x line. I'm using the varbiables as they relate to the solution of an ODE with boundary conditions.

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

回答 (1 件)

Walter Roberson
Walter Roberson 2019 年 12 月 3 日

0 投票

U is a symbolic variable, so f(U,0.01) is a symbolic expression involving the symbolic variable U
plot() can never plot symbolic expressions that contain unresolved symbolic variables.
Try fplot()

1 件のコメント

Walter Roberson
Walter Roberson 2019 年 12 月 3 日
Though now that I look at it again, you should probably be using fplot3(), like
fplot3( f(U, 0.01), f(U, 100), 0)
Provided, that is, that the idea is that you want to plot a parametric curve as the U values change.

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

カテゴリ

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

製品

リリース

R2019b

質問済み:

2019 年 12 月 3 日

コメント済み:

2019 年 12 月 3 日

Community Treasure Hunt

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

Start Hunting!

Translated by