Unable to convert expression into double array when using fplot function

clear;clc;
syms t
mh=1.67*10^-27;
me=9.1*10^-31;
h=6.62*10^-34;
chi=2.18*10^-18;
kb=1.38*10^-23;
rho=10^-3;
a=mh*(2*pi*me*kb*t)^(3/2)*exp(-chi/(kb*t))/(rho*h^3);
f=@(t) (-a+sqrt(a^2+4*a))/2;
fplot(f)
xlim([0,40000])
ylim([0,1])
I want to plot the function f versus t using fplot, but it gives me the error message Unable to convert expression into double array. What can I do here? Do I have to insert the whole expression "a" into "f" to make it work?
Thank you in advance! Anything is appreciated.

 採用された回答

Walter Roberson
Walter Roberson 2021 年 2 月 8 日
f = matlabFunction( -a+sqrt(a^2+4*a))/2 )

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Animation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by