Curve fitting of complex variable in Matlab

自闭症网瘾萝莉.ら 提交于 2019-12-24 02:09:47

问题


I want to solve the following system of equations shown in the image below,

The matrix system

where the component of the matrix A is complex numbers with the angle (theta) runs from 0 to 2*pi which has m divisions, and n = 9. The known value z = x + iy. Suppose the x and y of matrix z is

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 them iteratively? Notice that the value of the first component of the desired constants must equal 1. I am working with Matlab.


回答1:


You can apply simple multilinear regression for complex valued data.

Step 1. Get the matrix ready for linear regression

Your linear system

written without matrices, becomes

that rearranged yelds

If you rewrite it with matrices you get

Step 2. Apply multiple linear regression

Let the system above be

where

Now you can apply linear regression, that returns the best fit for α when

where

is the conjugate transpose.


In MATLAB

Y = Z - A(:,1);             % Calculate Y subtracting the first col of A from Z
R = A(:,:); R(:,1) = [];    % Calculate R as an exact copy of A, just without first column
Rs = ctranspose(R);         % Calculate R-star (conjugate transpose of R)
alpha = (Rs*R)^(-1)*Rs*Y;   % Finally apply multiple linear regression
alpha = cat(1, 1, alpha);   % Add alpha1 back, whose value is 1

or, if you prefer built-ins, have a look at regress function:

Y = Z - A(:,1);             % Calculate Y subtracting the first col of A from Z
R = A(:,:); R(:,1) = [];    % Calculate R as an exact copy of A, just without first column
alpha = regress(Y, R);      % Finally apply multiple linear regression
alpha = cat(1, 1, alpha);   % Add alpha1 back, whose value is 1


来源:https://stackoverflow.com/questions/48833281/curve-fitting-of-complex-variable-in-matlab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!