Warning: Error updating FunctionLine. for fplot

I am trying to create a function that summed up a bunch of other functions.
y1 = 0;
addi = 0.05;
aoamid = (2*0.6*sqrt(1-((y1)/4)^2)/(pi^2)+0.6/(8*pi))
CLnew = (aoamid+addi)/(2*sqrt(1-((y1)/4)^2)/(pi^2)+1/(8*pi))
m = (CLnew-0.6)/(addi)
aoafinal = aoamid - 0.6/m
N = 25;
Amatrix = zeros(N);
LLTmatrix = zeros(N,1);
A = sym('A', [N 1]);
for i = 1:N
theta = (1/48)*i+11/48;
for j = 1:N
Amatrix(i,j)= sinpi(j*theta)+(1/32)*2*pi*j*sinpi(j*theta)/sinpi(theta);
end
LLTmatrix(i,1) = (1/32)*2*pi*((2*0.6*sqrt(1-((4*cospi(theta))/4)^2)/(pi^2)+0.6/(8*pi))-aoamid);
end
AN = Amatrix\LLTmatrix;
%the really important part
cl = @(y) 0*y;
for i = 1:N
temp = @(y) AN(i,1)*sin(i*acos(y/4));
cl = @(y) cl + temp;
end
Clnew = @(y) 4*8*cl;
figure(2)
fplot(Clnew, [-4 4])
But this is the error I got:
Warning: Error updating FunctionLine.
The following error was reported evaluating the function in FunctionLine update:
Undefined function 'mtimes' for input arguments of type 'function_handle'.
I don't have mtimes in my code. Could you tell me what is going on?

回答(1 个)

Evaluate all the functions.
Try this —
y1 = 0;
addi = 0.05;
aoamid = (2*0.6*sqrt(1-((y1)/4)^2)/(pi^2)+0.6/(8*pi))
aoamid = 0.1455
CLnew = (aoamid+addi)/(2*sqrt(1-((y1)/4)^2)/(pi^2)+1/(8*pi))
CLnew = 0.8062
m = (CLnew-0.6)/(addi)
m = 4.1249
aoafinal = aoamid - 0.6/m
aoafinal = 8.3267e-17
N = 25;
Amatrix = zeros(N);
LLTmatrix = zeros(N,1);
A = sym('A', [N 1]);
for i = 1:N
theta = (1/48)*i+11/48;
for j = 1:N
Amatrix(i,j)= sinpi(j*theta)+(1/32)*2*pi*j*sinpi(j*theta)/sinpi(theta);
end
LLTmatrix(i,1) = (1/32)*2*pi*((2*0.6*sqrt(1-((4*cospi(theta))/4)^2)/(pi^2)+0.6/(8*pi))-aoamid);
end
AN = Amatrix\LLTmatrix;
%the really important part
cl = @(y) 0*y;
for i = 1:N
temp = @(y) AN(i,1)*sin(i*acos(y/4));
cl = @(y) cl(y) + temp(y); % <— CHANGED
end
Clnew = @(y) 4*8*cl(y); % <— CHANGED
figure(2)
fplot(Clnew, [-4 4])
.

类别

帮助中心File Exchange 中查找有关 Creating, Deleting, and Querying Graphics Objects 的更多信息

产品

版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by