필터 지우기
필터 지우기

How to solve nonlinear Trigonometry equations in matlab

조회 수: 1 (최근 30일)
Mohsen
Mohsen 2015년 5월 5일
댓글: Star Strider 2020년 6월 22일
Dear Friend I have a 5 nonlinear trigonometry equations with 5 parameters as following:
x*sin(z)-y*sin(k)=-2.061 ,
y*cos(k)-x*cos(z)=5.181 ,
x*cos(0.4904-z)+0.1*y*cos(0.4904+z)=0 ,
-1.032*cos(u)-0.1*y*sin(k)-0.2*x*sin(z)=-0.8821 ,
-1.032*sin(u)+0.1*y*cos(k)+0.2*x*cos(z)=-0.471 ,
How to calculate x,y,z,k,u? Best Regards

채택된 답변

Star Strider
Star Strider 2015년 5월 5일
One possibility:
% MAPPING: b(1) = x, b(2) = y, b(3) = z, b(4) = k, b(5) = u
f = @(b) [b(1)*sin(b(3))-b(2)*sin(b(4))+2.061
b(2)*cos(b(4))-b(1)*cos(b(3))-5.181
b(1)*cos(0.4904-b(3))+0.1*b(2)*cos(0.4904+b(3))
-1.032*cos(b(5))-0.1*b(2)*sin(b(4))-0.2*b(1)*sin(b(3))+0.8821
-1.032*sin(b(5))+0.1*b(2)*cos(b(4))+0.2*b(1)*cos(b(3))+0.471];
B0 = rand(5,1)*2*pi;
[B,fv,xf,ops] = fsolve(f, B0);
ps = ['x'; 'y'; 'z'; 'k'; 'u'];
fprintf(1, '\n\tParameters:\n')
for k1 = 1:length(B)
fprintf(1, '\t\t%s = % .4f\n', ps(k1,:), B(k1))
end
that with one set of initial parameter estimates produces:
Parameters:
x = 0.9478
y = 5.8864
z = 1.6950
k = 0.5351
u = 1.1792
  댓글 수: 5
Lonny Thompson
Lonny Thompson 2020년 6월 22일
yes, you need optimization toolbox to use fsolve.
another way to solve is using the symbolic toolbox solve function.
Star Strider
Star Strider 2020년 6월 22일
Another option is to use fminsearch:
[B,fv] = fminsearch(@(b)norm(f(b)-0), B0)
It may not be as accurate, however it will provide decent parameter estimates.
.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Nonlinear Optimization에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by