Filter löschen
Filter löschen

How to check the proportionaly of columns of a complex rectagular matrix?

1 Ansicht (letzte 30 Tage)
I have a complex matrix G of size 45 x 2, where in magitude wise the 2nd column is very small than 1st.
Here in the code columns of G are created as shown in the code. the files g1 and t are attached here.
I am looking for a correct methodology to check if the columns are propotional in a complex rectagular matrix G?
clear all;
close all;
load g1.mat
load t.mat
G = [g1 -g1.*t];

Akzeptierte Antwort

John D'Errico
John D'Errico am 22 Feb. 2023
Bearbeitet: John D'Errico am 22 Feb. 2023
Checking if two vectors (in your case, just columns of a matrix) are proportional is pretty easy, as well as then computing the constant of proportionality. You need to be careful, as you cannot just test the correlation coefficient between the vectors, since it is trivial to have two distinct vectors that are not proportional at all, yet share a perfect correlation. For example given a vector x, the vectot y=1+x has a correlation coefficient of EXACTLY 1, yet they are not proportional.
load g1.mat
load t.mat
Name Size Bytes Class Attributes ans 1x30 60 char cmdout 1x33 66 char g1 45x1 720 double complex t 45x1 360 double
t = 45×1
1.0e-03 * -0.1735 -0.1824 -0.1939 -0.2054 -0.2143 -0.2183 -0.2166 -0.2094 -0.1986 -0.1867
Unfortunately, I think you misunderstand what can be done here, and even what proportional really means. g1 and g1.*t are NOT proportional to each other. You multutiplied g1 by the elements of another, non-constant vector t. Again, t is not constant. t varies dramatically over the elements of t, so that it even changes sign. So g1 is NOT proportional to g1.*t.
For example, consider the vector
x = [1:5]';
y = randn(5,1);
ans = 5×3
1.0000 0.9764 0.9764 2.0000 0.6719 1.3439 3.0000 1.0125 3.0375 4.0000 1.7801 7.1205 5.0000 1.5934 7.9669
Is there any possible reason to decide that x and x.*y are "proportional" to each other? NO.
Given all that, what can you do? You might decide to formulate the question, is there some SCALAR CONSTANT value s, such that given only the vectors g1 and g1.*t, without knowing the vector t, where we can approximate the second vector with the product g1*s?
Honestly, IF you knew the vector t, then
s = mean(t);
would arguably be what you would want to do. But you can try to estimate the SCALAR constant s. The best estimate is: given by the backslash operator:
g2 = g1.*t;
s_est = g1\g2
s_est = -8.2677e-05 + 3.7221e-21i
As you can see, since both g1 and g2 are complex valued, a tiny amount of an imaginary part has crept in, but that is just floating point trash.
A minor problem in this is that the larger values (in magnitude) of g1 become the ones that have the largest influence on the resulting estimate of s. So in fact, we will not find s_est as being the same as mean(t).
ans = -5.1546e-05
And then the pertinent question becomes, how close are the two vectors to being truly proportional? this is a valid question. We might compare the norm(g1*s - g2), then scaled by the norm of g1.
format long g
norm(g1*s_est - g2)/norm(g1)
ans =
That would give us some sort of meaure of how well we did. So a small number here is good. Or, perhaps we could formulate it in the form people often use, where R^2 near 1 is a good thing. So:
1 - norm(g1*s_est - g2)/norm(g1)
ans =
So you would say the model is aruably a decent one, that s_est is a decent approximation. Finally, you might decide to plot the two vectors.
Warning: Imaginary parts of complex X and/or Y arguments ignored.
Perhaps the problem is you need to appreciate what proportionality means in context.

Weitere Antworten (1)

William Rose
William Rose am 22 Feb. 2023
The correlation is a measure of the proportionality of two vectors. When the vectors are complex, the correlation is complex. The magnitude of the complex correlation is between 0 and 1 and is a reasonable measure of proportionality.
The code below displays the mean of each column, and it displays the complex correlation and the magnitude of the complex correlation.
load g1.mat
load t.mat
G = [g1 -g1.*t];
fprintf('G(:,1): mean=%.3e + i*%.3e\n',real(mean(G(:,1))),imag(mean(G(:,1))))
G(:,1): mean=1.023e-01 + i*9.341e-02
fprintf('G(:,2): mean=%.3e + i*%.3e\n',real(mean(G(:,2))),imag(mean(G(:,2))))
G(:,2): mean=-3.074e-06 + i*2.825e-05
fprintf('Correlation = %.3f + i*%.3f\n',...
Correlation = 0.629 + i*-0.531
Good luck with your work.


Mehr zu Descriptive Statistics finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by