フィルターのクリア

How do I use Curve Fitting to fit a smooth curve to semilogy data?

18 ビュー (過去 30 日間)
Evan Rose
Evan Rose 2019 年 2 月 6 日
I have a dataset, shown in the figure, to which I would like to plot a smooth curve like in Excel. I tried using a smoothing spline but that doesn't hold up when I plot the data on a log-y axis. Is there a fit that would better suit my needs?
  1 件のコメント
Erialett Fernandez
Erialett Fernandez 2020 年 3 月 5 日
編集済み: Erialett Fernandez 2020 年 3 月 5 日
I'm having the same issue. I would like to smooth my plot that's on a log scale using semilogx. I have tried both smoothingspline and interpl and neither hold. Please provide examples of code using semilogx because the examples from matlab are using linear aplots nd those don't transfer :)
My normal plot:
f1 = figure;
w = [10^2,10^3,10^4,10^5,10^6];
Vc2 = [5,5,4.45,1.055,0.114];
semilogx(w,Vc2);
xlabel('\omega','FontSize',20,'FonWhentWeight','bold')
ylabel('|V_C(t)|','FontWeight','bold')
title('Part 2 Capacitor')
My attempt at interpl:
f1 = figure;
w = [10^2,10^3,10^4,10^5,10^6];
Vc2 = [5,5,4.45,1.055,0.114];
%Smooth the curve:
wi = logspace(2,6,150);
vi = interp1(w, Vc2, wi, 'spline');
semilogx(w,Vc2,'o',wi,vi);
xlabel('\omega','FontSize',20,'FonWhentWeight','bold')
ylabel('|V_C(t)|','FontWeight','bold')
title('Part 2 Capacitor')
it's somewhat doing it but I would like something much closer to the original shape of my first plot.

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

回答 (1 件)

Ankit Dutta
Ankit Dutta 2019 年 2 月 18 日
I hope you have already tried changing the different parameters available for smoothening the curve using "smoothing spline" function. You can refer to this link for more information.
Other than “smoothing spline” these methods can be used for smoothing and fitting the curve to data:
  • Interpolation Methods Estimating data between known data points
  • Lowess Smoothing Create a smooth surface using locally weighted linear regression to smooth data.
  • Filtering and Smoothing Data Using smooth function using methods for moving average, Savitzky-Golay filters, and local regression with and without weights and robustness
  1 件のコメント
Erialett Fernandez
Erialett Fernandez 2020 年 3 月 5 日
Can you post an example, please? I have followed the directions in these links but not sure what I'm missing and why it doesn't work on semilogx.

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

カテゴリ

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

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by