Error in my code

2 ビュー (過去 30 日間)
Abdallah Qaswal
Abdallah Qaswal 2022 年 12 月 28 日
回答済み: Image Analyst 2022 年 12 月 28 日
Urgent Help, please!
I have the following code. But I got the following error :
Attempt to add "fu1" to a static workspace.
Error in Qtest3 (line 2)
fu1 = @(x,y)9.02*10^28.*exp(-x.*2.33).*exp(-165*1*((5-x).^(0.5)-(16.*y).^0.5));
fu1 = @(x,y)9.02*10^28.*exp(-x.*2.33).*exp(-165*1*((5-x).^(0.5)-(16.*y).^0.5));
q = @(a,y)5.124+integral(@(x)fu1(x,y),0,a).*142-(exp(-37.45.*y).*(70.31));
fimplicit(q,[0 6 0 0.075],'MeshDensity',500, 'LineWidth',1.5),grid
hold off
legend('G = 5','Location','northeast')
xlabel('The tunneling-assissting thermal energy E(\times 10^{-20} J)','FontWeight','bold')
ylabel('The membrane potential V_m (V)','FontWeight','bold')
title('V_m{initial}= 0.07 V, L= 1\times 10^{-10} m, n = 1 and D = 10^{10} channels/cm^2')
ax=gca;
ax.FontSize=9;

回答 (2 件)

Voss
Voss 2022 年 12 月 28 日

Image Analyst
Image Analyst 2022 年 12 月 28 日
When I copy and paste your code I get this:
Warning: Inf or NaN value encountered.
> In integralCalc/iterateScalarValued (line 349)
In integralCalc/vadapt (line 132)
In integralCalc (line 75)
In integral (line 87)
In test6>@(a,y)5.124+integral(@(x)fu1(x,y),0,a).*142-(exp(-37.45.*y).*(70.31)) (line 2)
In matlab.graphics.function.ImplicitFunctionLine>getFunction
In matlab.graphics.function/ImplicitFunctionLine/updateFunction
In matlab.graphics.function/ImplicitFunctionLine/set.Function_I
In matlab.graphics.function/ImplicitFunctionLine/set.Function
In matlab.graphics.function.ImplicitFunctionLine
In fimplicit>singleFimplicit (line 193)
In fimplicit>@(f)singleFimplicit(cax,f,limits,extraOpts,args) (line 152)
In fimplicit>vectorizeFimplicit (line 152)
In fimplicit (line 126)
In test6 (line 3)
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.
> In matlab.graphics.function.ImplicitFunctionLine>getFunction
In matlab.graphics.function/ImplicitFunctionLine/updateFunction
In matlab.graphics.function/ImplicitFunctionLine/set.Function_I
In matlab.graphics.function/ImplicitFunctionLine/set.Function
In matlab.graphics.function.ImplicitFunctionLine
In fimplicit>singleFimplicit (line 193)
In fimplicit>@(f)singleFimplicit(cax,f,limits,extraOpts,args) (line 152)
In fimplicit>vectorizeFimplicit (line 152)
In fimplicit (line 126)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by