Clear Filters
Clear Filters

Error in my code

2 views (last 30 days)
Abdallah Qaswal
Abdallah Qaswal on 28 Dec 2022
Answered: Image Analyst on 28 Dec 2022
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;

Answers (2)

Voss
Voss on 28 Dec 2022

Image Analyst
Image Analyst on 28 Dec 2022
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)

Categories

Find more on Discrete Math in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!