필터 지우기
필터 지우기

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 CenterFile Exchange에서 Discrete Math에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by