fsolve no solution found

조회 수: 4 (최근 30일)
Shan  Chu
Shan Chu 2018년 5월 11일
답변: Walter Roberson 2018년 5월 14일
Dear all, I have a system of non-linear equations that needs to be solved. I have read some articles from Matlab to improve the performance of fsolve but alas, it hasn't been successful.
Could you please help me? Thanks
P/S: the general curves of alpha and beta look actually quite right (I'm not sure about the quantity) except the fact that there is a small peak at element 570. I would expect a smooth curve there so I think it's because of the no solution found from fsolve.
The code is as follows:
close all
clear all
clc
load('Data.mat')
x0=[pi;0];
for m=1:1:length(w_vector)
w=w_vector(m);
options = optimoptions('fsolve','Display','iter','Algorithm','levenberg-marquardt','ScaleProblem','jacobian','MaxFunctionEvaluations',2000,'MaxIterations',1500,'OptimalityTolerance',1e-12,'FunctionTolerance',1e-20,'StepTolerance',1e-12);
F_med = @(x) [real(k1_l)*cosh(x(1))*cos(x(2))-imag(k1_l)*sinh(x(1))*sin(x(2))+real(k2_l)*cosh(2*x(1))*cos(2*x(2))-imag(k2_l)*sinh(2*x(1))*sin(2*x(2))+real(k3_l)*cosh(3*x(1))*cos(3*x(2))-imag(k3_l)*sinh(3*x(1))*sin(3*x(2))-(w0/w)^2+1+real(L1_l(m)/L);...
real(k1_l)*sinh(x(1))*sin(x(2))+imag(k1_l)*cosh(x(1))*cos(x(2))+real(k2_l)*sinh(2*x(1))*sin(2*x(2))+imag(k2_l)*cosh(2*x(1))*cos(2*x(2))+real(k3_l)*sinh(3*x(1))*sin(3*x(2))+imag(k3_l)*cosh(3*x(1))*cos(3*x(2))-(1/Q)*(w0/w)+imag(L1_l(m)/L)];
[x,fval] = fsolve(F_med,x0,options);
alpha(m)=x(1);
beta(m)=x(2);
x0 = [x(1);x(2)];
end
figure
hold on
plot(alpha,'r','Linewidth',3)
plot(beta,'b--','Linewidth',3)
axis tight square
grid on
set(findall(gcf,'-property','FontName'),'FontName', 'Times New Roman','fontsize',22)
  댓글 수: 2
Walter Roberson
Walter Roberson 2018년 5월 11일
x0 is needed for the fsolve() call, but is not defined in your code and is not part of the .mat file.
Shan  Chu
Shan Chu 2018년 5월 14일
Hi, X0=[pi;0];
I also corrected the question

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2018년 5월 14일
You are trying to solve a system of 2 x 1001 equations in two variables, simultaneously, because your equation is in terms of the k* variables that are 1 x 1001.
Perhaps you want to loop over corresponding k* variables.

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by