FIt an inverse equation

6 ビュー (過去 30 日間)
Giru Mishra
Giru Mishra 2018 年 5 月 17 日
回答済み: Parag 2025 年 4 月 8 日
I want to fit log(y) = 3/log(x) over log(y) vs log(x) plot. I know x and y.
Please help me with it.

回答 (1 件)

Parag
Parag 2025 年 4 月 8 日
Hi @Giru Mishra,
To visualize the model log(y)=3log(x)\log(y) = \frac{3}{\log(x)}log(y)=log(x)3​ alongside your data in a log(y)\log(y)log(y) vs log(x)\log(x)log(x) plot, you can utilize the MATLAB code below. This will overlay your actual data points and the theoretical model for comparison. Please ensure that all values the arrays “x and y are positive before applying the logarithm.
% Replace with your actual data
x = [...]; % Vector of x values
y = [...]; % Vector of y values
% Ensure positive values
assert(all(x > 0) && all(y > 0), 'x and y must be positive for log.');
% Compute logarithms
logx = log(x);
logy = log(y);
% Theoretical model: log(y) = 3 / log(x)
model_logy = 3 ./ logx;
% Plot actual vs model
figure;
plot(logx, logy, 'bo', 'DisplayName', 'Actual log(y)'); hold on;
plot(logx, model_logy, 'r-', 'LineWidth', 2, 'DisplayName', 'Model: log(y) = 3 / log(x)');
xlabel('log(x)');
ylabel('log(y)');
title('log(y) vs log(x) with model overlay');
legend;
grid on;
I hope this is beneficial!

カテゴリ

Help Center および File ExchangeExponents and Logarithms についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by