Solving system of equations
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
Hi expert,
May I ask your suggestion on how to solve the following matrix system,

where the component of the matrix A is complex numbers with the angle (theta) runs from 0 to 2*pi, and n = 9. The known value z = x + iy = re^ia, is also complex numbers as such, r = sqrt(x^2+y^2) and a = atan (y/x)
Suppose matrix z is as shown below,
z =
0 1.0148
0.1736 0.9848
0.3420 0.9397
0.5047 0.8742
0.6748 0.8042
0.8419 0.7065
0.9919 0.5727
1.1049 0.4022
1.1757 0.2073
1.1999 0
1.1757 -0.2073
1.1049 -0.4022
0.9919 -0.5727
0.8419 -0.7065
0.6748 -0.8042
0.5047 -0.8742
0.3420 -0.9397
0.1736 -0.9848
0 -1.0148
How do you solve the system of equations above i.e. to find the coefficient of matrix alpha. I tried using a simple matrix manipulation X = inv((tran(A)*A))*tran(A)*z, but I cannot get a reasonable result.
I would expect the solution i.e. components of matrix alpa to be a real numbers.
채택된 답변
What do the two columns of z mean? Is the 2nd column supposed to be the imaginary part of z? If so,
Z=complex(z(:,1),z(:,2));
X = A\Z
댓글 수: 11
Hi Matt,
The column of z means the x and y component of the z = x + i*y i.e. z is a complex numbers.
I tried the same approach as you suggested, but somethow when I back calculate z from the (now) known A and matrix alpha, I could not get it even close to z.
In that, I expext the solution of X could gives a minimum error to z.
X is definitely the minimum least square fit of Z (assuming there are no other constraints that you haven't yet mentioned). It might be a bad fit, but it is the best fit, given your data.
to 'give a minimum error to z' you may want to consider
abs(z)
instead.
Matt J
why is this answer accepted if BeSet writes not yet agreeing with result?
@John BG: After your many discussions about accepting answers, you should know, that only the OP can do this in the first week after asking. Therefore there is no reason to ask Matt J, why the OP BeSet has accepted the answer.
@John BG:
As Jan said, I have no control over the accept-status of the answer. It is conceivable, however, that the OP posted initial doubts about the answer, but later resolved them and accept-clicked.
BeeTiaw
2018년 2월 16일
Hi All,
Sorry for my delayed response. I mistakenly and did not realize that I have clicked "accept" earlier which apparently has caused confusion in this thread. Sorry. I have unchecked the "accept".
Back to my earlier post.
Suppose now I want to set the value of "alpha_0", i.e. the first component of the desired constants, equals 1, how do I solve the problem iteratively? Can we use the "fit" function within Matlab?
Matt J
2018년 2월 16일
Why iteratively when you can do it analytically?
Thanks for your prompt response.
Because the first component must equal to 1, then I would expect the problem can only be solved iteratively? Isn't it?
Unless you know how to solve them analytically, I would be happy to use the method.
Below is the system that I want to solve (slightly modified from the original post)

Where the angle (theta) runs from 0 to 2*pi which has m divisions, and n = 9.
Notice that the value of the first component of the desired constants must equal 1.
The known value z = x + iy = re^ia, is also complex numbers as such, r = sqrt(x^2+y^2) and a = atan (y/x)
Suppose matrix z is as shown below,
z =
0 1.0148
0.1736 0.9848
0.3420 0.9397
0.5047 0.8742
0.6748 0.8042
0.8419 0.7065
0.9919 0.5727
1.1049 0.4022
1.1757 0.2073
1.1999 0
1.1757 -0.2073
1.1049 -0.4022
0.9919 -0.5727
0.8419 -0.7065
0.6748 -0.8042
0.5047 -0.8742
0.3420 -0.9397
0.1736 -0.9848
0 -1.0148
I am trying to use the following function,
https://uk.mathworks.com/help/optim/ug/lsqlin.html#inputarg_C
but it seems that it only works for integer while my case involves complex number.
Matt J
2018년 2월 17일
If the first value is 1, then this just leads to a mild modification of my initial proposal,
zc=complex(z(:,1),z(:,2));
alpha=A(:,2:end)\(zc-A(:,1))
This solves for the unknown alpha (alpha2,...,alphaN).
Jan
2019년 4월 25일
@BeeTiaw: Which code do you consider as correct? What does "it seems that I have not got the right answer" mean? Which answer from which code to which input is meant here?
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Mathematics에 대해 자세히 알아보기
참고 항목
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
