Error using %4122905695>@()NaN Too many input arguments.

Hi, I am getting the error message above from my codes. How can I overcome this error message? Any help is appreciated.
My codes are below.
format long
clear all
close all
clc
syms x
syms y
%syms t
q=0.2; %W/cm2
a=0.25; %cm
L1=0.5; %cm
L2=1.5; %cm
h=0.001; %W/cm2.K
k=0.011; %W/cm.K
T_ambient=23;
T_initial=T_ambient;
alpha=0.0005789;%k/ro*c
delt=0.0220; %delt stands for deltatime<=(delx^2)/2alfa
Ts=1;
T=0;
for i=1:10
lambda=(i*pi)/(2*L2);
int1=integral(@(x)(q*cos(lambda*x)),L2-a,L2+a);
int2=integral(@(x)((cos(lambda*x)).^2),L2-a,L2+a);
Cn=int1./int2;
A2B1=-Cn./(k*lambda);
p1=(k.*lambda.*cosh(lambda.*L1))+(h.*sinh(lambda.*L1));
p2=(h.*cosh(lambda.*L1))+(k.*lambda.*sinh(lambda.*L1));
B3=p1./p2;
T=T+(A2B1.*cos(lambda.*x)).*(sinh(lambda.*y)-B3.*cosh(lambda.*y));
end
theta=0+T_initial;
for t=1:Ts
for m=1:1
mu=(m*pi)/(2*L2);
for n=1:1
beta=-662.09*n+3755.8;
int3=integral(@(x)(cos(mu.*x).^2),0,2*L2);
int4=integral(@(y)(cos(beta.*y).^2),0,L1);
ht=matlabFunction(-T.*cos(mu.*x)*cos(beta.*y));
int5=integral2(ht,0,(2*L2),0,L1,'RelTol',1e-12,'AbsTol',1e-14,'Method','iterated');
Fmn=int5/(int3*int4);
qt=(Fmn.*cos(mu.*x)*cos(beta.*y)*exp(-alpha*(mu.^2+beta.^2).*t));
theta=theta+qt;
end
end
figure
ezcontourf(theta+T,[0 3],[0 0.5]);
xlabel('x [cm]')
ylabel('y [cm]')
title('Temperature Distribution [C]')
end

2 Comments

%4122905695>@()NaN is not a function name. Please post the entire error message - line number and code and everything - not just part of it. In other words, paste ALL the red text not just some of it.

Sign in to comment.

 Accepted Answer

Your integral2() is failing, and when it does, NaN is being returned. When the NaN is added to the symbolic formula being created, NaN is the result, so your T ends being NaN, rather than a formula in x and y that happens to produce NaN. ezcontour() then fails because it is expecting a formula in two variables.
The easiest fix is to convert everything to symbolic. I have attached the revised code.

More Answers (0)

Categories

Tags

Community Treasure Hunt

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

Start Hunting!