フィルターのクリア

Error with plotting a function

1 回表示 (過去 30 日間)
Ethan Anderson
Ethan Anderson 2021 年 2 月 10 日
回答済み: Chad Greene 2021 年 2 月 10 日
I can't seem to figure out how to just plot the function y = K^(1-e^(-rt)). How can I get this to plot? Every way I seem to input the values in the plot function, it calls an error in line 6.
K = 10;
r = .1;
t = 0:1:100;
solution1 = @(t,y) K ^ (1 - (exp(-t*r)));
plot(t,(K^(1 - (exp(t*r*-1)))), '-b');
hold on

採用された回答

madhan ravi
madhan ravi 2021 年 2 月 10 日
編集済み: madhan ravi 2021 年 2 月 10 日
K = 10;
r = .1;
t = 0:1:100;
solution1 = @(t,y) K .^ (1 - (exp(-t*r)));
plot(t,(K.^(1 - (exp(t*r*-1)))), '-b');

その他の回答 (1 件)

Chad Greene
Chad Greene 2021 年 2 月 10 日
Try this:
plot(t,(K.^(1 - (exp(t.*r.*-1)))), '-b');
I put a dot (.) before the exponents and multiplication. That turns it into a dot product instead of the default cross product.

タグ

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by