フィルターのクリア

Inverse of log formula

23 ビュー (過去 30 日間)
Lisa
Lisa 2017 年 5 月 1 日
回答済み: Image Analyst 2017 年 5 月 1 日
Hi, I have the following formula:
y = -log(x / mean(x))
y and x are vector’s.
However, in my case I only know y, but not x. Therefore, I would like to solve the inverse of the formula for x. I am aware of that exp is the inverse of log:
x=-exp(y)
but I am not sure how to consider the term mean(x)?
Thank you in advance.
Lisa

採用された回答

Star Strider
Star Strider 2017 年 5 月 1 日
You cannot determine ‘mean(x)’ unless you have access to the original ‘x’ vector. (If you had ‘x’, you would not need to do the inversion.) You can only recover the normalised ratio ‘x/mean(x)’.
  3 件のコメント
Lisa
Lisa 2017 年 5 月 1 日
Thank you very much.
Star Strider
Star Strider 2017 年 5 月 1 日
@Lisa — As always, my pleasure!
@John D’Errico — Thank you!

サインインしてコメントする。

その他の回答 (2 件)

Image Analyst
Image Analyst 2017 年 5 月 1 日
Try fzero().
  1 件のコメント
John D'Errico
John D'Errico 2017 年 5 月 1 日
Nope. Not possible to use fzero here.

サインインしてコメントする。


Image Analyst
Image Analyst 2017 年 5 月 1 日
Lisa, is this what you are after - to find the x for a y that is a specified value? You can do it numerically like this, where I find the x where y = 1:
% Define a range of x values.
x = sort(rand(1, 500), 'ascend');
% Compute the y values over that range.
fprintf('mean(x) = %f\n', mean(x));
y = -log(x / mean(x));
% Plot curve.
plot(x, y, 'b-', 'LineWidth', 2);
grid on;
xlabel('x', 'FontSize', 20);
ylabel('y', 'FontSize', 20);
% Find the x closest to y = 1 (for example).
[minValue, index] = min(abs(y-1))
% Get x and y values
x1 = x(index);
y1 = y(index);
fprintf('Closest point: y = %f at x = %f\n', y1, x1);
% Draw lines
hold on;
line([0, x1], [y1, y1], 'Color', 'r', 'LineWidth', 2);
line([x1, x1], [0, y1], 'Color', 'r', 'LineWidth', 2);
ax = gca;
ax.XAxisLocation = 'origin';
In the command window:
mean(x) = 0.514679
minValue =
0.0017406261319084
index =
93
Closest point: y = 1.001741 at x = 0.189011
And the plot of the results:

カテゴリ

Help Center および File ExchangeTime Series についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by