反转一系列数据,就像使用MATLAB反转函数一样 [英] Invert a series of data as if inverting a function using MATLAB
问题描述
是否可以像反转函数一样反转"一系列数据?
Is it possible to "invert" a series of data like when a function is inverted?
让我解释一下.如果我有一个可以在MATLAB中绘制的函数,我总是(几乎)可以通过finverse
找到该函数的逆函数,并且该图将提供以下信息:
Let me explain. If I have a function that I can plot in MATLAB, I can always (almost) find the inverse of such function with the finverse
and the plot would provide this:
但是我没有用于数据的函数,我仍然想找到这类数据系列的逆函数,例如y=f(x)
where
But I do not have the a function for my data, and I would still like to find a sort of inverse of such series of data, like for example y=f(x)
where
x=[0.0050879 0.0056528 0.0062176 0.0067822 0.0073467 0.0079111 0.0084752 0.0090392 0.0096030 0.0101666 0.0107299 0.0112930 0.0118558 0.0124184 0.0129807 0.0135428 0.0141045 0.0146659 0.0152270 0.0157877 0.0163481];
和
y=[0.0000e+00 0.0000e+00 0.0000e+00 0.0000e+00 0.0000e+00 0.0000e+00 0.0000e+00 0.0000e+00 0.0000e+00 0.0000e+00 4.4901e-05 4.4901e-05 8.9801e-05 1.3470e-04 1.7960e-04 2.2450e-04 2.6940e-04 3.5920e-04 4.0411e-04 4.9391e-04 5.8371e-04];
在MATLAB中可以对一系列数据进行这种操作吗?是否有可以解决这个问题的技术/方法/功能?
Is this kind of operation on a series of data possible in MATLAB? Is there a technique/method/function that handles this?
注意:我以前尝试通过polyfit
函数使用多项式对数据序列进行拟合",然后通过finverse
函数对其进行求逆;但是会导致同时依赖x
和y
的f^-1
函数.而且由于x
的间距甚至不均匀,我什至都不知道如何绘制...
NOTE: I previously tried to "fit" the series of data with a polynomial via the polyfit
function and then invert it via the finverse
function; but it results in an f^-1
function that is dependent on both x
and y
at the same time. And because x
is not even spaced homogeneously, I do not even know how to plot it...
推荐答案
通过更改x
和y
:(y, x)
的位置,可以反转由一系列(x, y)
数据点表示的函数.可以在Matlab中将其可视化,如下所示:
Inverting a function represented by a series of (x, y)
data points is done by changing the position of x
and y
: (y, x)
. This can be visualised in Matlab as follows:
figure
hold on
plot(x, y, 'red')
plot(y, x, 'blue')
from = min(min(x), min(y));
to = max(max(x), max(y));
plot([from to], [from to], 'k--')
legend('Original', 'Inverted')
这篇关于反转一系列数据,就像使用MATLAB反转函数一样的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!