Matlab中复杂变量的曲线拟合 [英] Curve fitting of complex variable in Matlab

查看:452
本文介绍了Matlab中复杂变量的曲线拟合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想解决下图所示的以下方程组,

矩阵系统

,其中矩阵A的成分是复数,其角度(θ)从具有m个分度的0 to 2*pin = 9延伸.已知值z = x + iy.假设矩阵z的x和y为

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

您如何迭代解决它们?请注意,所需常量的第一部分的值必须等于1.我正在使用Matlab.

解决方案

您可以申请 简单的多线性回归 用于复杂值数据.

步骤1.准备好矩阵以进行线性回归

您的线性系统

在没有矩阵的情况下写成

重新调整了产量

如果用矩阵重写它,您将得到

步骤2.应用多元线性回归

让上面的系统成为

其中

现在您可以应用线性回归,当时返回最适合α

其中

共轭转置.


在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

,或者,如果您喜欢内置,请查看 regress 函数:

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

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.

解决方案

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

这篇关于Matlab中复杂变量的曲线拟合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆