Warning: Error updating FunctionLine. for fplot
조회 수: 5 (최근 30일)
이전 댓글 표시
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?
댓글 수: 0
답변 (1개)
Star Strider
2023년 2월 23일
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))
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(y) + temp(y); % <— CHANGED
end
Clnew = @(y) 4*8*cl(y); % <— CHANGED
figure(2)
fplot(Clnew, [-4 4])
.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!